From ce10f35a20483e67070d36cadc9c14360d350964 Mon Sep 17 00:00:00 2001 From: Jiahui Peng <46921893+Alancere@users.noreply.github.com> Date: Tue, 7 Dec 2021 17:05:08 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/healthcareapis/armhealthcareapis/0.1.0 (#16380) * [Release] sdk/resourcemanager/healthcareapis/armhealthcareapis/0.1.0 generation from spec commit: 3c5135f8325eaf79be7b137cae363bdcba028c17 * Update CHANGELOG.md Co-authored-by: Dapeng Zhang --- .../armhealthcareapis/CHANGELOG.md | 5 + .../armhealthcareapis/LICENSE.txt | 21 + .../armhealthcareapis/README.md | 75 + .../armhealthcareapis/autorest.md | 13 + .../healthcareapis/armhealthcareapis/build.go | 7 + .../healthcareapis/armhealthcareapis/ci.yml | 27 + .../healthcareapis/armhealthcareapis/go.mod | 9 + .../healthcareapis/armhealthcareapis/go.sum | 45 + .../armhealthcareapis/go_mod_tidy_hack.go | 13 + ...rated_example_dicomservices_client_test.go | 143 ++ ...ed_example_fhirdestinations_client_test.go | 39 + ...erated_example_fhirservices_client_test.go | 191 +++ ...iotconnectorfhirdestination_client_test.go | 123 ++ ...rated_example_iotconnectors_client_test.go | 191 +++ ...ed_example_operationresults_client_test.go | 35 + ...enerated_example_operations_client_test.go | 33 + ..._privateendpointconnections_client_test.go | 109 ++ ...xample_privatelinkresources_client_test.go | 53 + ..._generated_example_services_client_test.go | 215 +++ ...enerated_example_workspaces_client_test.go | 157 ++ .../zz_generated_constants.go | 304 ++++ .../zz_generated_dicomservices_client.go | 414 ++++++ .../zz_generated_fhirdestinations_client.go | 109 ++ .../zz_generated_fhirservices_client.go | 414 ++++++ ...ated_iotconnectorfhirdestination_client.go | 284 ++++ .../zz_generated_iotconnectors_client.go | 414 ++++++ .../armhealthcareapis/zz_generated_models.go | 1275 +++++++++++++++++ .../zz_generated_operationresults_client.go | 108 ++ .../zz_generated_operations_client.go | 89 ++ .../armhealthcareapis/zz_generated_pagers.go | 503 +++++++ .../armhealthcareapis/zz_generated_pollers.go | 832 +++++++++++ ...rated_privateendpointconnections_client.go | 337 +++++ ...z_generated_privatelinkresources_client.go | 177 +++ .../zz_generated_response_types.go | 1214 ++++++++++++++++ .../zz_generated_services_client.go | 505 +++++++ .../zz_generated_time_rfc3339.go | 85 ++ .../zz_generated_workspaces_client.go | 448 ++++++ 37 files changed, 9016 insertions(+) create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/CHANGELOG.md create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/LICENSE.txt create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/README.md create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/autorest.md create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/build.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ci.yml create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/go.mod create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/go.sum create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_dicomservices_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirdestinations_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirservices_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectorfhirdestination_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectors_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operationresults_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operations_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privateendpointconnections_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privatelinkresources_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_services_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_workspaces_client_test.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_constants.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_dicomservices_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirdestinations_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirservices_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectorfhirdestination_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectors_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_models.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operationresults_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privatelinkresources_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_services_client.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_workspaces_client.go diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/CHANGELOG.md b/sdk/resourcemanager/healthcareapis/armhealthcareapis/CHANGELOG.md new file mode 100644 index 000000000000..549748e2931f --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-07) + +- Init release. diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/LICENSE.txt b/sdk/resourcemanager/healthcareapis/armhealthcareapis/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/README.md b/sdk/resourcemanager/healthcareapis/armhealthcareapis/README.md new file mode 100644 index 000000000000..b39578b57301 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/README.md @@ -0,0 +1,75 @@ +# Azure Healthcare APIs Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis) + +The `armhealthcareapis` module provides operations for working with Azure Healthcare APIs. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/healthcareapis/armhealthcareapis) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.13 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Healthcare APIs module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Healthcare APIs. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Healthcare APIs modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client := armhealthcareapis.NewIotConnectorFhirDestinationClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armhealthcareapis.NewIotConnectorFhirDestinationClient(, cred, &options) +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Healthcare APIs` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/autorest.md b/sdk/resourcemanager/healthcareapis/armhealthcareapis/autorest.md new file mode 100644 index 000000000000..97e5e099f85f --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/3c5135f8325eaf79be7b137cae363bdcba028c17/specification/healthcareapis/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/3c5135f8325eaf79be7b137cae363bdcba028c17/specification/healthcareapis/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/build.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/build.go new file mode 100644 index 000000000000..9ff167e4e911 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/healthcareapis/armhealthcareapis + +package armhealthcareapis diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ci.yml b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ci.yml new file mode 100644 index 000000000000..3076ad66a31e --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/healthcareapis/armhealthcareapis/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/healthcareapis/armhealthcareapis/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/healthcareapis/armhealthcareapis' diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/go.mod b/sdk/resourcemanager/healthcareapis/armhealthcareapis/go.mod new file mode 100644 index 000000000000..eb2d88c26e3b --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/go.mod @@ -0,0 +1,9 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v59.4.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 +) diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/go.sum b/sdk/resourcemanager/healthcareapis/armhealthcareapis/go.sum new file mode 100644 index 000000000000..b5602e34337c --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/go.sum @@ -0,0 +1,45 @@ +github.com/Azure/azure-sdk-for-go v59.4.0+incompatible h1:gDA8odnngdNd3KYHL2NoK1j9vpWBgEnFSjKKLpkC8Aw= +github.com/Azure/azure-sdk-for-go v59.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 h1:VBvHGLJbaY0+c66NZHdS9cgjHVYSH6DDa0XJMyrblsI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0/go.mod h1:GJzjM4SR9T0KyX5gKCVyz1ytD8FeWeUPCwtFCt1AyfE= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/go_mod_tidy_hack.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/go_mod_tidy_hack.go new file mode 100644 index 000000000000..a7901f933f42 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armhealthcareapis + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_dicomservices_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_dicomservices_client_test.go new file mode 100644 index 000000000000..4337d1248f66 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_dicomservices_client_test.go @@ -0,0 +1,143 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/dicomservices/DicomServices_List.json +func ExampleDicomServicesClient_ListByWorkspace() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewDicomServicesClient("", cred, nil) + pager := client.ListByWorkspace("", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("DicomService.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/dicomservices/DicomServices_Get.json +func ExampleDicomServicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewDicomServicesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("DicomService.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/dicomservices/DicomServices_Create.json +func ExampleDicomServicesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewDicomServicesClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armhealthcareapis.DicomService{ + TaggedResource: armhealthcareapis.TaggedResource{ + LocationBasedResource: armhealthcareapis.LocationBasedResource{ + Location: to.StringPtr(""), + }, + }, + Properties: &armhealthcareapis.DicomServiceProperties{}, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("DicomService.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/dicomservices/DicomServices_Patch.json +func ExampleDicomServicesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewDicomServicesClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + "", + armhealthcareapis.DicomServicePatchResource{ + ResourceTags: armhealthcareapis.ResourceTags{ + Tags: map[string]*string{ + "tagKey": to.StringPtr("tagValue"), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("DicomService.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/dicomservices/DicomServices_Delete.json +func ExampleDicomServicesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewDicomServicesClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirdestinations_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirdestinations_client_test.go new file mode 100644 index 000000000000..5d1796a249a0 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirdestinations_client_test.go @@ -0,0 +1,39 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_fhirdestination_List.json +func ExampleFhirDestinationsClient_ListByIotConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewFhirDestinationsClient("", cred, nil) + pager := client.ListByIotConnector("", + "", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("IotFhirDestination.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirservices_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirservices_client_test.go new file mode 100644 index 000000000000..86c12c797bfc --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_fhirservices_client_test.go @@ -0,0 +1,191 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/fhirservices/FhirServices_List.json +func ExampleFhirServicesClient_ListByWorkspace() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewFhirServicesClient("", cred, nil) + pager := client.ListByWorkspace("", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("FhirService.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/fhirservices/FhirServices_Get.json +func ExampleFhirServicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewFhirServicesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("FhirService.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/fhirservices/FhirServices_Create.json +func ExampleFhirServicesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewFhirServicesClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armhealthcareapis.FhirService{ + ServiceManagedIdentity: armhealthcareapis.ServiceManagedIdentity{ + Identity: &armhealthcareapis.ServiceManagedIdentityIdentity{ + Type: armhealthcareapis.ManagedServiceIdentityTypeSystemAssigned.ToPtr(), + }, + }, + TaggedResource: armhealthcareapis.TaggedResource{ + LocationBasedResource: armhealthcareapis.LocationBasedResource{ + Location: to.StringPtr(""), + }, + ResourceTags: armhealthcareapis.ResourceTags{ + Tags: map[string]*string{ + "additionalProp1": to.StringPtr("string"), + "additionalProp2": to.StringPtr("string"), + "additionalProp3": to.StringPtr("string"), + }, + }, + }, + Kind: armhealthcareapis.FhirServiceKindFhirR4.ToPtr(), + Properties: &armhealthcareapis.FhirServiceProperties{ + AccessPolicies: []*armhealthcareapis.FhirServiceAccessPolicyEntry{ + { + ObjectID: to.StringPtr(""), + }, + { + ObjectID: to.StringPtr(""), + }}, + AcrConfiguration: &armhealthcareapis.FhirServiceAcrConfiguration{ + LoginServers: []*string{ + to.StringPtr("test1.azurecr.io")}, + }, + AuthenticationConfiguration: &armhealthcareapis.FhirServiceAuthenticationConfiguration{ + Audience: to.StringPtr(""), + Authority: to.StringPtr(""), + SmartProxyEnabled: to.BoolPtr(true), + }, + CorsConfiguration: &armhealthcareapis.FhirServiceCorsConfiguration{ + AllowCredentials: to.BoolPtr(false), + Headers: []*string{ + to.StringPtr("*")}, + MaxAge: to.Int32Ptr(1440), + Methods: []*string{ + to.StringPtr("DELETE"), + to.StringPtr("GET"), + to.StringPtr("OPTIONS"), + to.StringPtr("PATCH"), + to.StringPtr("POST"), + to.StringPtr("PUT")}, + Origins: []*string{ + to.StringPtr("*")}, + }, + ExportConfiguration: &armhealthcareapis.FhirServiceExportConfiguration{ + StorageAccountName: to.StringPtr(""), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("FhirService.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/fhirservices/FhirServices_Patch.json +func ExampleFhirServicesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewFhirServicesClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + "", + armhealthcareapis.FhirServicePatchResource{ + ResourceTags: armhealthcareapis.ResourceTags{ + Tags: map[string]*string{ + "tagKey": to.StringPtr("tagValue"), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("FhirService.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/fhirservices/FhirServices_Delete.json +func ExampleFhirServicesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewFhirServicesClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectorfhirdestination_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectorfhirdestination_client_test.go new file mode 100644 index 000000000000..894ed852f556 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectorfhirdestination_client_test.go @@ -0,0 +1,123 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_fhirdestination_Get.json +func ExampleIotConnectorFhirDestinationClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorFhirDestinationClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("IotFhirDestination.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_fhirdestination_Create.json +func ExampleIotConnectorFhirDestinationClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorFhirDestinationClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + "", + armhealthcareapis.IotFhirDestination{ + LocationBasedResource: armhealthcareapis.LocationBasedResource{ + Location: to.StringPtr(""), + }, + Properties: &armhealthcareapis.IotFhirDestinationProperties{ + FhirMapping: &armhealthcareapis.IotMappingProperties{ + Content: map[string]interface{}{ + "template": []interface{}{ + map[string]interface{}{ + "template": map[string]interface{}{ + "codes": []interface{}{ + map[string]interface{}{ + "code": "8867-4", + "display": "Heart rate", + "system": "http://loinc.org", + }, + }, + "periodInterval": 60, + "typeName": "heartrate", + "value": map[string]interface{}{ + "defaultPeriod": 5000, + "unit": "count/min", + "valueName": "hr", + "valueType": "SampledData", + }, + }, + "templateType": "CodeValueFhir", + }, + }, + "templateType": "CollectionFhirTemplate", + }, + }, + FhirServiceResourceID: to.StringPtr(""), + ResourceIdentityResolutionType: armhealthcareapis.IotIdentityResolutionTypeCreate.ToPtr(), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("IotFhirDestination.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_fhirdestination_Delete.json +func ExampleIotConnectorFhirDestinationClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorFhirDestinationClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectors_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectors_client_test.go new file mode 100644 index 000000000000..be46be017a99 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_iotconnectors_client_test.go @@ -0,0 +1,191 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_List.json +func ExampleIotConnectorsClient_ListByWorkspace() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorsClient("", cred, nil) + pager := client.ListByWorkspace("", + "", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("IotConnector.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_Get.json +func ExampleIotConnectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("IotConnector.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_Create.json +func ExampleIotConnectorsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorsClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armhealthcareapis.IotConnector{ + ServiceManagedIdentity: armhealthcareapis.ServiceManagedIdentity{ + Identity: &armhealthcareapis.ServiceManagedIdentityIdentity{ + Type: armhealthcareapis.ManagedServiceIdentityTypeSystemAssigned.ToPtr(), + }, + }, + TaggedResource: armhealthcareapis.TaggedResource{ + LocationBasedResource: armhealthcareapis.LocationBasedResource{ + Location: to.StringPtr(""), + }, + ResourceTags: armhealthcareapis.ResourceTags{ + Tags: map[string]*string{ + "additionalProp1": to.StringPtr("string"), + "additionalProp2": to.StringPtr("string"), + "additionalProp3": to.StringPtr("string"), + }, + }, + }, + Properties: &armhealthcareapis.IotConnectorProperties{ + DeviceMapping: &armhealthcareapis.IotMappingProperties{ + Content: map[string]interface{}{ + "template": []interface{}{ + map[string]interface{}{ + "template": map[string]interface{}{ + "deviceIdExpression": "$.deviceid", + "timestampExpression": "$.measurementdatetime", + "typeMatchExpression": "$..[?(@heartrate)]", + "typeName": "heartrate", + "values": []interface{}{ + map[string]interface{}{ + "required": "true", + "valueExpression": "$.heartrate", + "valueName": "hr", + }, + }, + }, + "templateType": "JsonPathContent", + }, + }, + "templateType": "CollectionContent", + }, + }, + IngestionEndpointConfiguration: &armhealthcareapis.IotEventHubIngestionEndpointConfiguration{ + ConsumerGroup: to.StringPtr(""), + EventHubName: to.StringPtr(""), + FullyQualifiedEventHubNamespace: to.StringPtr(""), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("IotConnector.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_Patch.json +func ExampleIotConnectorsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorsClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + "", + armhealthcareapis.IotConnectorPatchResource{ + ResourceTags: armhealthcareapis.ResourceTags{ + Tags: map[string]*string{ + "additionalProp1": to.StringPtr("string"), + "additionalProp2": to.StringPtr("string"), + "additionalProp3": to.StringPtr("string"), + }, + }, + ServiceManagedIdentity: armhealthcareapis.ServiceManagedIdentity{ + Identity: &armhealthcareapis.ServiceManagedIdentityIdentity{ + Type: armhealthcareapis.ManagedServiceIdentityTypeSystemAssigned.ToPtr(), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("IotConnector.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/iotconnectors/iotconnector_Delete.json +func ExampleIotConnectorsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewIotConnectorsClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operationresults_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operationresults_client_test.go new file mode 100644 index 000000000000..f86abe2e56ab --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operationresults_client_test.go @@ -0,0 +1,35 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/OperationResultsGet.json +func ExampleOperationResultsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewOperationResultsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationResultsDescription.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operations_client_test.go new file mode 100644 index 000000000000..64fc4dac77bf --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_operations_client_test.go @@ -0,0 +1,33 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/OperationsList.json +func ExampleOperationsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewOperationsClient(cred, nil) + pager := client.List(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privateendpointconnections_client_test.go new file mode 100644 index 000000000000..004bfc925f10 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privateendpointconnections_client_test.go @@ -0,0 +1,109 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewPrivateEndpointConnectionsClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewPrivateEndpointConnectionsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnectionDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewPrivateEndpointConnectionsClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armhealthcareapis.PrivateEndpointConnection{ + Properties: &armhealthcareapis.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armhealthcareapis.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armhealthcareapis.PrivateEndpointServiceConnectionStatusApproved.ToPtr(), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnectionDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewPrivateEndpointConnectionsClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privatelinkresources_client_test.go new file mode 100644 index 000000000000..60d6072a169f --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_privatelinkresources_client_test.go @@ -0,0 +1,53 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/PrivateLinkResourcesListByService.json +func ExamplePrivateLinkResourcesClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewPrivateLinkResourcesClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/PrivateLinkResourceGet.json +func ExamplePrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewPrivateLinkResourcesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResourceDescription.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_services_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_services_client_test.go new file mode 100644 index 000000000000..3c985e468bac --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_services_client_test.go @@ -0,0 +1,215 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceGet.json +func ExampleServicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("ServicesDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceCreate.json +func ExampleServicesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armhealthcareapis.ServicesDescription{ + ServicesResource: armhealthcareapis.ServicesResource{ + Identity: &armhealthcareapis.ServicesResourceIdentity{ + Type: armhealthcareapis.ManagedServiceIdentityTypeSystemAssigned.ToPtr(), + }, + Kind: armhealthcareapis.KindFhirR4.ToPtr(), + Location: to.StringPtr(""), + Tags: map[string]*string{}, + }, + Properties: &armhealthcareapis.ServicesProperties{ + AccessPolicies: []*armhealthcareapis.ServiceAccessPolicyEntry{ + { + ObjectID: to.StringPtr(""), + }, + { + ObjectID: to.StringPtr(""), + }}, + AuthenticationConfiguration: &armhealthcareapis.ServiceAuthenticationConfigurationInfo{ + Audience: to.StringPtr(""), + Authority: to.StringPtr(""), + SmartProxyEnabled: to.BoolPtr(true), + }, + CorsConfiguration: &armhealthcareapis.ServiceCorsConfigurationInfo{ + AllowCredentials: to.BoolPtr(false), + Headers: []*string{ + to.StringPtr("*")}, + MaxAge: to.Int32Ptr(1440), + Methods: []*string{ + to.StringPtr("DELETE"), + to.StringPtr("GET"), + to.StringPtr("OPTIONS"), + to.StringPtr("PATCH"), + to.StringPtr("POST"), + to.StringPtr("PUT")}, + Origins: []*string{ + to.StringPtr("*")}, + }, + CosmosDbConfiguration: &armhealthcareapis.ServiceCosmosDbConfigurationInfo{ + KeyVaultKeyURI: to.StringPtr(""), + OfferThroughput: to.Int32Ptr(1000), + }, + ExportConfiguration: &armhealthcareapis.ServiceExportConfigurationInfo{ + StorageAccountName: to.StringPtr(""), + }, + PrivateEndpointConnections: []*armhealthcareapis.PrivateEndpointConnection{}, + PublicNetworkAccess: armhealthcareapis.PublicNetworkAccessDisabled.ToPtr(), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("ServicesDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServicePatch.json +func ExampleServicesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armhealthcareapis.ServicesPatchDescription{ + Tags: map[string]*string{ + "tag1": to.StringPtr("value1"), + "tag2": to.StringPtr("value2"), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("ServicesDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceDelete.json +func ExampleServicesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceList.json +func ExampleServicesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + pager := client.List(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("ServicesDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/legacy/ServiceListByResourceGroup.json +func ExampleServicesClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + pager := client.ListByResourceGroup("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("ServicesDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/CheckNameAvailabilityPost.json +func ExampleServicesClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewServicesClient("", cred, nil) + _, err = client.CheckNameAvailability(ctx, + armhealthcareapis.CheckNameAvailabilityParameters{ + Name: to.StringPtr(""), + Type: to.StringPtr(""), + }, + nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_workspaces_client_test.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_workspaces_client_test.go new file mode 100644 index 000000000000..80993b6aef3c --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/ze_generated_example_workspaces_client_test.go @@ -0,0 +1,157 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthcareapis/armhealthcareapis" +) + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/workspaces/Workspaces_ListBySubscription.json +func ExampleWorkspacesClient_ListBySubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewWorkspacesClient("", cred, nil) + pager := client.ListBySubscription(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("Workspace.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/workspaces/Workspaces_ListByResourceGroup.json +func ExampleWorkspacesClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewWorkspacesClient("", cred, nil) + pager := client.ListByResourceGroup("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("Workspace.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/workspaces/Workspaces_Get.json +func ExampleWorkspacesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewWorkspacesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Workspace.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/workspaces/Workspaces_Create.json +func ExampleWorkspacesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewWorkspacesClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armhealthcareapis.Workspace{ + TaggedResource: armhealthcareapis.TaggedResource{ + LocationBasedResource: armhealthcareapis.LocationBasedResource{ + Location: to.StringPtr(""), + }, + }, + Properties: &armhealthcareapis.WorkspaceProperties{}, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("Workspace.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/workspaces/Workspaces_Patch.json +func ExampleWorkspacesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewWorkspacesClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armhealthcareapis.WorkspacePatchResource{ + ResourceTags: armhealthcareapis.ResourceTags{ + Tags: map[string]*string{ + "tagKey": to.StringPtr("tagValue"), + }, + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("Workspace.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/preview/2021-06-01-preview/examples/workspaces/Workspaces_Delete.json +func ExampleWorkspacesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armhealthcareapis.NewWorkspacesClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + _, err = poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_constants.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_constants.go new file mode 100644 index 000000000000..efb1cf7708a1 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_constants.go @@ -0,0 +1,304 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +const ( + module = "armhealthcareapis" + version = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// ToPtr returns a *ActionType pointing to the current value. +func (c ActionType) ToPtr() *ActionType { + return &c +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// FhirServiceKind - The kind of the service. +type FhirServiceKind string + +const ( + FhirServiceKindFhirR4 FhirServiceKind = "fhir-R4" + FhirServiceKindFhirStu3 FhirServiceKind = "fhir-Stu3" +) + +// PossibleFhirServiceKindValues returns the possible values for the FhirServiceKind const type. +func PossibleFhirServiceKindValues() []FhirServiceKind { + return []FhirServiceKind{ + FhirServiceKindFhirR4, + FhirServiceKindFhirStu3, + } +} + +// ToPtr returns a *FhirServiceKind pointing to the current value. +func (c FhirServiceKind) ToPtr() *FhirServiceKind { + return &c +} + +// IotIdentityResolutionType - The type of IoT identity resolution to use with the destination. +type IotIdentityResolutionType string + +const ( + IotIdentityResolutionTypeCreate IotIdentityResolutionType = "Create" + IotIdentityResolutionTypeLookup IotIdentityResolutionType = "Lookup" +) + +// PossibleIotIdentityResolutionTypeValues returns the possible values for the IotIdentityResolutionType const type. +func PossibleIotIdentityResolutionTypeValues() []IotIdentityResolutionType { + return []IotIdentityResolutionType{ + IotIdentityResolutionTypeCreate, + IotIdentityResolutionTypeLookup, + } +} + +// ToPtr returns a *IotIdentityResolutionType pointing to the current value. +func (c IotIdentityResolutionType) ToPtr() *IotIdentityResolutionType { + return &c +} + +// Kind - The kind of the service. +type Kind string + +const ( + KindFhir Kind = "fhir" + KindFhirStu3 Kind = "fhir-Stu3" + KindFhirR4 Kind = "fhir-R4" +) + +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindFhir, + KindFhirStu3, + KindFhirR4, + } +} + +// ToPtr returns a *Kind pointing to the current value. +func (c Kind) ToPtr() *Kind { + return &c +} + +// ManagedServiceIdentityType - Type of identity being specified, currently SystemAssigned and None are allowed. +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + } +} + +// ToPtr returns a *ManagedServiceIdentityType pointing to the current value. +func (c ManagedServiceIdentityType) ToPtr() *ManagedServiceIdentityType { + return &c +} + +// OperationResultStatus - The status of the operation being performed. +type OperationResultStatus string + +const ( + OperationResultStatusCanceled OperationResultStatus = "Canceled" + OperationResultStatusFailed OperationResultStatus = "Failed" + OperationResultStatusRequested OperationResultStatus = "Requested" + OperationResultStatusRunning OperationResultStatus = "Running" + OperationResultStatusSucceeded OperationResultStatus = "Succeeded" +) + +// PossibleOperationResultStatusValues returns the possible values for the OperationResultStatus const type. +func PossibleOperationResultStatusValues() []OperationResultStatus { + return []OperationResultStatus{ + OperationResultStatusCanceled, + OperationResultStatusFailed, + OperationResultStatusRequested, + OperationResultStatusRunning, + OperationResultStatusSucceeded, + } +} + +// ToPtr returns a *OperationResultStatus pointing to the current value. +func (c OperationResultStatus) ToPtr() *OperationResultStatus { + return &c +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value. +func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState { + return &c +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value. +func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus { + return &c +} + +// ProvisioningState - The provisioning state. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDeprovisioned ProvisioningState = "Deprovisioned" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateSuspended ProvisioningState = "Suspended" + ProvisioningStateSystemMaintenance ProvisioningState = "SystemMaintenance" + ProvisioningStateUpdating ProvisioningState = "Updating" + ProvisioningStateVerifying ProvisioningState = "Verifying" + ProvisioningStateWarned ProvisioningState = "Warned" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateDeprovisioned, + ProvisioningStateFailed, + ProvisioningStateMoving, + ProvisioningStateSucceeded, + ProvisioningStateSuspended, + ProvisioningStateSystemMaintenance, + ProvisioningStateUpdating, + ProvisioningStateVerifying, + ProvisioningStateWarned, + } +} + +// ToPtr returns a *ProvisioningState pointing to the current value. +func (c ProvisioningState) ToPtr() *ProvisioningState { + return &c +} + +// PublicNetworkAccess - Control permission for data plane traffic coming from public networks while private endpoint is enabled. +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// ToPtr returns a *PublicNetworkAccess pointing to the current value. +func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { + return &c +} + +// ServiceNameUnavailabilityReason - The reason for unavailability. +type ServiceNameUnavailabilityReason string + +const ( + ServiceNameUnavailabilityReasonInvalid ServiceNameUnavailabilityReason = "Invalid" + ServiceNameUnavailabilityReasonAlreadyExists ServiceNameUnavailabilityReason = "AlreadyExists" +) + +// PossibleServiceNameUnavailabilityReasonValues returns the possible values for the ServiceNameUnavailabilityReason const type. +func PossibleServiceNameUnavailabilityReasonValues() []ServiceNameUnavailabilityReason { + return []ServiceNameUnavailabilityReason{ + ServiceNameUnavailabilityReasonInvalid, + ServiceNameUnavailabilityReasonAlreadyExists, + } +} + +// ToPtr returns a *ServiceNameUnavailabilityReason pointing to the current value. +func (c ServiceNameUnavailabilityReason) ToPtr() *ServiceNameUnavailabilityReason { + return &c +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_dicomservices_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_dicomservices_client.go new file mode 100644 index 000000000000..b8b54dd0340a --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_dicomservices_client.go @@ -0,0 +1,414 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DicomServicesClient contains the methods for the DicomServices group. +// Don't use this type directly, use NewDicomServicesClient() instead. +type DicomServicesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewDicomServicesClient creates a new instance of DicomServicesClient with the specified values. +func NewDicomServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DicomServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DicomServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a DICOM Service resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *DicomServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dicomServiceName string, dicomservice DicomService, options *DicomServicesBeginCreateOrUpdateOptions) (DicomServicesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, dicomServiceName, dicomservice, options) + if err != nil { + return DicomServicesCreateOrUpdatePollerResponse{}, err + } + result := DicomServicesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DicomServicesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return DicomServicesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &DicomServicesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a DICOM Service resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *DicomServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dicomServiceName string, dicomservice DicomService, options *DicomServicesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, dicomServiceName, dicomservice, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DicomServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, dicomServiceName string, dicomservice DicomService, options *DicomServicesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if dicomServiceName == "" { + return nil, errors.New("parameter dicomServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dicomServiceName}", url.PathEscape(dicomServiceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, dicomservice) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *DicomServicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a DICOM Service. +// If the operation fails it returns the *Error error type. +func (client *DicomServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, options *DicomServicesBeginDeleteOptions) (DicomServicesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, dicomServiceName, workspaceName, options) + if err != nil { + return DicomServicesDeletePollerResponse{}, err + } + result := DicomServicesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DicomServicesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return DicomServicesDeletePollerResponse{}, err + } + result.Poller = &DicomServicesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a DICOM Service. +// If the operation fails it returns the *Error error type. +func (client *DicomServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, options *DicomServicesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dicomServiceName, workspaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DicomServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, options *DicomServicesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dicomServiceName == "" { + return nil, errors.New("parameter dicomServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dicomServiceName}", url.PathEscape(dicomServiceName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *DicomServicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified DICOM Service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *DicomServicesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, dicomServiceName string, options *DicomServicesGetOptions) (DicomServicesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, dicomServiceName, options) + if err != nil { + return DicomServicesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DicomServicesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DicomServicesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DicomServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, dicomServiceName string, options *DicomServicesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if dicomServiceName == "" { + return nil, errors.New("parameter dicomServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dicomServiceName}", url.PathEscape(dicomServiceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DicomServicesClient) getHandleResponse(resp *http.Response) (DicomServicesGetResponse, error) { + result := DicomServicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DicomService); err != nil { + return DicomServicesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *DicomServicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByWorkspace - Lists all DICOM Services for the given workspace +// If the operation fails it returns the *ErrorDetails error type. +func (client *DicomServicesClient) ListByWorkspace(resourceGroupName string, workspaceName string, options *DicomServicesListByWorkspaceOptions) *DicomServicesListByWorkspacePager { + return &DicomServicesListByWorkspacePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, + advancer: func(ctx context.Context, resp DicomServicesListByWorkspaceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DicomServiceCollection.NextLink) + }, + } +} + +// listByWorkspaceCreateRequest creates the ListByWorkspace request. +func (client *DicomServicesClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *DicomServicesListByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByWorkspaceHandleResponse handles the ListByWorkspace response. +func (client *DicomServicesClient) listByWorkspaceHandleResponse(resp *http.Response) (DicomServicesListByWorkspaceResponse, error) { + result := DicomServicesListByWorkspaceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DicomServiceCollection); err != nil { + return DicomServicesListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByWorkspaceHandleError handles the ListByWorkspace error response. +func (client *DicomServicesClient) listByWorkspaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Patch DICOM Service details. +// If the operation fails it returns the *ErrorDetails error type. +func (client *DicomServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, dicomservicePatchResource DicomServicePatchResource, options *DicomServicesBeginUpdateOptions) (DicomServicesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource, options) + if err != nil { + return DicomServicesUpdatePollerResponse{}, err + } + result := DicomServicesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DicomServicesClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return DicomServicesUpdatePollerResponse{}, err + } + result.Poller = &DicomServicesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch DICOM Service details. +// If the operation fails it returns the *ErrorDetails error type. +func (client *DicomServicesClient) update(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, dicomservicePatchResource DicomServicePatchResource, options *DicomServicesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DicomServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, dicomservicePatchResource DicomServicePatchResource, options *DicomServicesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if dicomServiceName == "" { + return nil, errors.New("parameter dicomServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dicomServiceName}", url.PathEscape(dicomServiceName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, dicomservicePatchResource) +} + +// updateHandleError handles the Update error response. +func (client *DicomServicesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirdestinations_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirdestinations_client.go new file mode 100644 index 000000000000..d303b6345b10 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirdestinations_client.go @@ -0,0 +1,109 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FhirDestinationsClient contains the methods for the FhirDestinations group. +// Don't use this type directly, use NewFhirDestinationsClient() instead. +type FhirDestinationsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewFhirDestinationsClient creates a new instance of FhirDestinationsClient with the specified values. +func NewFhirDestinationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FhirDestinationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FhirDestinationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// ListByIotConnector - Lists all FHIR destinations for the given IoT Connector +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirDestinationsClient) ListByIotConnector(resourceGroupName string, workspaceName string, iotConnectorName string, options *FhirDestinationsListByIotConnectorOptions) *FhirDestinationsListByIotConnectorPager { + return &FhirDestinationsListByIotConnectorPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByIotConnectorCreateRequest(ctx, resourceGroupName, workspaceName, iotConnectorName, options) + }, + advancer: func(ctx context.Context, resp FhirDestinationsListByIotConnectorResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.IotFhirDestinationCollection.NextLink) + }, + } +} + +// listByIotConnectorCreateRequest creates the ListByIotConnector request. +func (client *FhirDestinationsClient) listByIotConnectorCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, options *FhirDestinationsListByIotConnectorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByIotConnectorHandleResponse handles the ListByIotConnector response. +func (client *FhirDestinationsClient) listByIotConnectorHandleResponse(resp *http.Response) (FhirDestinationsListByIotConnectorResponse, error) { + result := FhirDestinationsListByIotConnectorResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.IotFhirDestinationCollection); err != nil { + return FhirDestinationsListByIotConnectorResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByIotConnectorHandleError handles the ListByIotConnector error response. +func (client *FhirDestinationsClient) listByIotConnectorHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirservices_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirservices_client.go new file mode 100644 index 000000000000..73b26a1f7006 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_fhirservices_client.go @@ -0,0 +1,414 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FhirServicesClient contains the methods for the FhirServices group. +// Don't use this type directly, use NewFhirServicesClient() instead. +type FhirServicesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewFhirServicesClient creates a new instance of FhirServicesClient with the specified values. +func NewFhirServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FhirServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FhirServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a FHIR Service resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, fhirServiceName string, fhirservice FhirService, options *FhirServicesBeginCreateOrUpdateOptions) (FhirServicesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, fhirServiceName, fhirservice, options) + if err != nil { + return FhirServicesCreateOrUpdatePollerResponse{}, err + } + result := FhirServicesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("FhirServicesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return FhirServicesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &FhirServicesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a FHIR Service resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, fhirServiceName string, fhirservice FhirService, options *FhirServicesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, fhirServiceName, fhirservice, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FhirServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, fhirServiceName string, fhirservice FhirService, options *FhirServicesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if fhirServiceName == "" { + return nil, errors.New("parameter fhirServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirServiceName}", url.PathEscape(fhirServiceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, fhirservice) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *FhirServicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a FHIR Service. +// If the operation fails it returns the *Error error type. +func (client *FhirServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, fhirServiceName string, workspaceName string, options *FhirServicesBeginDeleteOptions) (FhirServicesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, fhirServiceName, workspaceName, options) + if err != nil { + return FhirServicesDeletePollerResponse{}, err + } + result := FhirServicesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("FhirServicesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return FhirServicesDeletePollerResponse{}, err + } + result.Poller = &FhirServicesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a FHIR Service. +// If the operation fails it returns the *Error error type. +func (client *FhirServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, fhirServiceName string, workspaceName string, options *FhirServicesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fhirServiceName, workspaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FhirServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fhirServiceName string, workspaceName string, options *FhirServicesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fhirServiceName == "" { + return nil, errors.New("parameter fhirServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirServiceName}", url.PathEscape(fhirServiceName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *FhirServicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified FHIR Service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirServicesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, fhirServiceName string, options *FhirServicesGetOptions) (FhirServicesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, fhirServiceName, options) + if err != nil { + return FhirServicesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FhirServicesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FhirServicesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FhirServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, fhirServiceName string, options *FhirServicesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if fhirServiceName == "" { + return nil, errors.New("parameter fhirServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirServiceName}", url.PathEscape(fhirServiceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FhirServicesClient) getHandleResponse(resp *http.Response) (FhirServicesGetResponse, error) { + result := FhirServicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.FhirService); err != nil { + return FhirServicesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *FhirServicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByWorkspace - Lists all FHIR Services for the given workspace +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirServicesClient) ListByWorkspace(resourceGroupName string, workspaceName string, options *FhirServicesListByWorkspaceOptions) *FhirServicesListByWorkspacePager { + return &FhirServicesListByWorkspacePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, + advancer: func(ctx context.Context, resp FhirServicesListByWorkspaceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.FhirServiceCollection.NextLink) + }, + } +} + +// listByWorkspaceCreateRequest creates the ListByWorkspace request. +func (client *FhirServicesClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *FhirServicesListByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByWorkspaceHandleResponse handles the ListByWorkspace response. +func (client *FhirServicesClient) listByWorkspaceHandleResponse(resp *http.Response) (FhirServicesListByWorkspaceResponse, error) { + result := FhirServicesListByWorkspaceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.FhirServiceCollection); err != nil { + return FhirServicesListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByWorkspaceHandleError handles the ListByWorkspace error response. +func (client *FhirServicesClient) listByWorkspaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Patch FHIR Service details. +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, fhirServiceName string, workspaceName string, fhirservicePatchResource FhirServicePatchResource, options *FhirServicesBeginUpdateOptions) (FhirServicesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource, options) + if err != nil { + return FhirServicesUpdatePollerResponse{}, err + } + result := FhirServicesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("FhirServicesClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return FhirServicesUpdatePollerResponse{}, err + } + result.Poller = &FhirServicesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch FHIR Service details. +// If the operation fails it returns the *ErrorDetails error type. +func (client *FhirServicesClient) update(ctx context.Context, resourceGroupName string, fhirServiceName string, workspaceName string, fhirservicePatchResource FhirServicePatchResource, options *FhirServicesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *FhirServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fhirServiceName string, workspaceName string, fhirservicePatchResource FhirServicePatchResource, options *FhirServicesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if fhirServiceName == "" { + return nil, errors.New("parameter fhirServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirServiceName}", url.PathEscape(fhirServiceName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, fhirservicePatchResource) +} + +// updateHandleError handles the Update error response. +func (client *FhirServicesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectorfhirdestination_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectorfhirdestination_client.go new file mode 100644 index 000000000000..5d4ae4e85e7f --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectorfhirdestination_client.go @@ -0,0 +1,284 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// IotConnectorFhirDestinationClient contains the methods for the IotConnectorFhirDestination group. +// Don't use this type directly, use NewIotConnectorFhirDestinationClient() instead. +type IotConnectorFhirDestinationClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewIotConnectorFhirDestinationClient creates a new instance of IotConnectorFhirDestinationClient with the specified values. +func NewIotConnectorFhirDestinationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotConnectorFhirDestinationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotConnectorFhirDestinationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates an IoT Connector FHIR destination resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorFhirDestinationClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, iotFhirDestination IotFhirDestination, options *IotConnectorFhirDestinationBeginCreateOrUpdateOptions) (IotConnectorFhirDestinationCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination, options) + if err != nil { + return IotConnectorFhirDestinationCreateOrUpdatePollerResponse{}, err + } + result := IotConnectorFhirDestinationCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("IotConnectorFhirDestinationClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return IotConnectorFhirDestinationCreateOrUpdatePollerResponse{}, err + } + result.Poller = &IotConnectorFhirDestinationCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates an IoT Connector FHIR destination resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorFhirDestinationClient) createOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, iotFhirDestination IotFhirDestination, options *IotConnectorFhirDestinationBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IotConnectorFhirDestinationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, iotFhirDestination IotFhirDestination, options *IotConnectorFhirDestinationBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + if fhirDestinationName == "" { + return nil, errors.New("parameter fhirDestinationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirDestinationName}", url.PathEscape(fhirDestinationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, iotFhirDestination) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *IotConnectorFhirDestinationClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes an IoT Connector FHIR destination. +// If the operation fails it returns the *Error error type. +func (client *IotConnectorFhirDestinationClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, options *IotConnectorFhirDestinationBeginDeleteOptions) (IotConnectorFhirDestinationDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, options) + if err != nil { + return IotConnectorFhirDestinationDeletePollerResponse{}, err + } + result := IotConnectorFhirDestinationDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("IotConnectorFhirDestinationClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return IotConnectorFhirDestinationDeletePollerResponse{}, err + } + result.Poller = &IotConnectorFhirDestinationDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes an IoT Connector FHIR destination. +// If the operation fails it returns the *Error error type. +func (client *IotConnectorFhirDestinationClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, options *IotConnectorFhirDestinationBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IotConnectorFhirDestinationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, options *IotConnectorFhirDestinationBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + if fhirDestinationName == "" { + return nil, errors.New("parameter fhirDestinationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirDestinationName}", url.PathEscape(fhirDestinationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *IotConnectorFhirDestinationClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified Iot Connector FHIR destination. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorFhirDestinationClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, options *IotConnectorFhirDestinationGetOptions) (IotConnectorFhirDestinationGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, options) + if err != nil { + return IotConnectorFhirDestinationGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IotConnectorFhirDestinationGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IotConnectorFhirDestinationGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *IotConnectorFhirDestinationClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, fhirDestinationName string, options *IotConnectorFhirDestinationGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + if fhirDestinationName == "" { + return nil, errors.New("parameter fhirDestinationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fhirDestinationName}", url.PathEscape(fhirDestinationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IotConnectorFhirDestinationClient) getHandleResponse(resp *http.Response) (IotConnectorFhirDestinationGetResponse, error) { + result := IotConnectorFhirDestinationGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.IotFhirDestination); err != nil { + return IotConnectorFhirDestinationGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *IotConnectorFhirDestinationClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectors_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectors_client.go new file mode 100644 index 000000000000..7aebac85f130 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_iotconnectors_client.go @@ -0,0 +1,414 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// IotConnectorsClient contains the methods for the IotConnectors group. +// Don't use this type directly, use NewIotConnectorsClient() instead. +type IotConnectorsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewIotConnectorsClient creates a new instance of IotConnectorsClient with the specified values. +func NewIotConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotConnectorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotConnectorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates an IoT Connector resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, iotConnector IotConnector, options *IotConnectorsBeginCreateOrUpdateOptions) (IotConnectorsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, iotConnectorName, iotConnector, options) + if err != nil { + return IotConnectorsCreateOrUpdatePollerResponse{}, err + } + result := IotConnectorsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("IotConnectorsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return IotConnectorsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &IotConnectorsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates an IoT Connector resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, iotConnector IotConnector, options *IotConnectorsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, iotConnectorName, iotConnector, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IotConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, iotConnector IotConnector, options *IotConnectorsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, iotConnector) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *IotConnectorsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes an IoT Connector. +// If the operation fails it returns the *Error error type. +func (client *IotConnectorsClient) BeginDelete(ctx context.Context, resourceGroupName string, iotConnectorName string, workspaceName string, options *IotConnectorsBeginDeleteOptions) (IotConnectorsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, iotConnectorName, workspaceName, options) + if err != nil { + return IotConnectorsDeletePollerResponse{}, err + } + result := IotConnectorsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("IotConnectorsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return IotConnectorsDeletePollerResponse{}, err + } + result.Poller = &IotConnectorsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes an IoT Connector. +// If the operation fails it returns the *Error error type. +func (client *IotConnectorsClient) deleteOperation(ctx context.Context, resourceGroupName string, iotConnectorName string, workspaceName string, options *IotConnectorsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, iotConnectorName, workspaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IotConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, iotConnectorName string, workspaceName string, options *IotConnectorsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *IotConnectorsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified IoT Connector. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, options *IotConnectorsGetOptions) (IotConnectorsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, iotConnectorName, options) + if err != nil { + return IotConnectorsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IotConnectorsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IotConnectorsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *IotConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, iotConnectorName string, options *IotConnectorsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IotConnectorsClient) getHandleResponse(resp *http.Response) (IotConnectorsGetResponse, error) { + result := IotConnectorsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.IotConnector); err != nil { + return IotConnectorsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *IotConnectorsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByWorkspace - Lists all IoT Connectors for the given workspace +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorsClient) ListByWorkspace(resourceGroupName string, workspaceName string, options *IotConnectorsListByWorkspaceOptions) *IotConnectorsListByWorkspacePager { + return &IotConnectorsListByWorkspacePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByWorkspaceCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, + advancer: func(ctx context.Context, resp IotConnectorsListByWorkspaceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.IotConnectorCollection.NextLink) + }, + } +} + +// listByWorkspaceCreateRequest creates the ListByWorkspace request. +func (client *IotConnectorsClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *IotConnectorsListByWorkspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByWorkspaceHandleResponse handles the ListByWorkspace response. +func (client *IotConnectorsClient) listByWorkspaceHandleResponse(resp *http.Response) (IotConnectorsListByWorkspaceResponse, error) { + result := IotConnectorsListByWorkspaceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.IotConnectorCollection); err != nil { + return IotConnectorsListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByWorkspaceHandleError handles the ListByWorkspace error response. +func (client *IotConnectorsClient) listByWorkspaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Patch an IoT Connector. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorsClient) BeginUpdate(ctx context.Context, resourceGroupName string, iotConnectorName string, workspaceName string, iotConnectorPatchResource IotConnectorPatchResource, options *IotConnectorsBeginUpdateOptions) (IotConnectorsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource, options) + if err != nil { + return IotConnectorsUpdatePollerResponse{}, err + } + result := IotConnectorsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("IotConnectorsClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return IotConnectorsUpdatePollerResponse{}, err + } + result.Poller = &IotConnectorsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch an IoT Connector. +// If the operation fails it returns the *ErrorDetails error type. +func (client *IotConnectorsClient) update(ctx context.Context, resourceGroupName string, iotConnectorName string, workspaceName string, iotConnectorPatchResource IotConnectorPatchResource, options *IotConnectorsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *IotConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, iotConnectorName string, workspaceName string, iotConnectorPatchResource IotConnectorPatchResource, options *IotConnectorsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if iotConnectorName == "" { + return nil, errors.New("parameter iotConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{iotConnectorName}", url.PathEscape(iotConnectorName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, iotConnectorPatchResource) +} + +// updateHandleError handles the Update error response. +func (client *IotConnectorsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_models.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_models.go new file mode 100644 index 000000000000..6c9fdede9d53 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_models.go @@ -0,0 +1,1275 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// CheckNameAvailabilityParameters - Input values. +type CheckNameAvailabilityParameters struct { + // REQUIRED; The name of the service instance to check. + Name *string `json:"name,omitempty"` + + // REQUIRED; The fully qualified resource type which includes provider namespace. + Type *string `json:"type,omitempty"` +} + +// DicomService - The description of Dicom Service +type DicomService struct { + TaggedResource + // Dicom Service configuration. + Properties *DicomServiceProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DicomService. +func (d DicomService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.TaggedResource.marshalInternal(objectMap) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + return json.Marshal(objectMap) +} + +// DicomServiceAuthenticationConfiguration - Authentication configuration information +type DicomServiceAuthenticationConfiguration struct { + // READ-ONLY; The audiences for the service + Audiences []*string `json:"audiences,omitempty" azure:"ro"` + + // READ-ONLY; The authority url for the service + Authority *string `json:"authority,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type DicomServiceAuthenticationConfiguration. +func (d DicomServiceAuthenticationConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "audiences", d.Audiences) + populate(objectMap, "authority", d.Authority) + return json.Marshal(objectMap) +} + +// DicomServiceCollection - The collection of Dicom Services. +type DicomServiceCollection struct { + // The link used to get the next page of Dicom Services. + NextLink *string `json:"nextLink,omitempty"` + + // The list of Dicom Services. + Value []*DicomService `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DicomServiceCollection. +func (d DicomServiceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// DicomServicePatchResource - Dicom Service patch properties +type DicomServicePatchResource struct { + ResourceTags +} + +// DicomServiceProperties - Dicom Service properties. +type DicomServiceProperties struct { + // Dicom Service authentication configuration. + AuthenticationConfiguration *DicomServiceAuthenticationConfiguration `json:"authenticationConfiguration,omitempty"` + + // The provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + + // READ-ONLY; The url of the Dicom Services. + ServiceURL *string `json:"serviceUrl,omitempty" azure:"ro"` +} + +// DicomServicesBeginCreateOrUpdateOptions contains the optional parameters for the DicomServices.BeginCreateOrUpdate method. +type DicomServicesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DicomServicesBeginDeleteOptions contains the optional parameters for the DicomServices.BeginDelete method. +type DicomServicesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// DicomServicesBeginUpdateOptions contains the optional parameters for the DicomServices.BeginUpdate method. +type DicomServicesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// DicomServicesGetOptions contains the optional parameters for the DicomServices.Get method. +type DicomServicesGetOptions struct { + // placeholder for future optional parameters +} + +// DicomServicesListByWorkspaceOptions contains the optional parameters for the DicomServices.ListByWorkspace method. +type DicomServicesListByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// Error details. +// Implements the error and azcore.HTTPResponse interfaces. +type Error struct { + raw string + // Error details + InnerError *ErrorDetailsInternal `json:"error,omitempty"` +} + +// Error implements the error interface for type Error. +// The contents of the error text are not contractual and subject to change. +func (e Error) Error() string { + return e.raw +} + +// ErrorDetails - Error details. +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorDetails struct { + raw string + // Error details + InnerError *ErrorDetailsInternal `json:"error,omitempty"` +} + +// Error implements the error interface for type ErrorDetails. +// The contents of the error text are not contractual and subject to change. +func (e ErrorDetails) Error() string { + return e.raw +} + +// ErrorDetailsInternal - Error details. +type ErrorDetailsInternal struct { + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The target of the particular error. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// FhirDestinationsListByIotConnectorOptions contains the optional parameters for the FhirDestinations.ListByIotConnector method. +type FhirDestinationsListByIotConnectorOptions struct { + // placeholder for future optional parameters +} + +// FhirService - The description of Fhir Service +type FhirService struct { + ServiceManagedIdentity + TaggedResource + // The kind of the service. + Kind *FhirServiceKind `json:"kind,omitempty"` + + // Fhir Service configuration. + Properties *FhirServiceProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type FhirService. +func (f FhirService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + f.TaggedResource.marshalInternal(objectMap) + f.ServiceManagedIdentity.marshalInternal(objectMap) + populate(objectMap, "kind", f.Kind) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + return json.Marshal(objectMap) +} + +// FhirServiceAccessPolicyEntry - An access policy entry. +type FhirServiceAccessPolicyEntry struct { + // REQUIRED; An Azure AD object ID (User or Apps) that is allowed access to the FHIR service. + ObjectID *string `json:"objectId,omitempty"` +} + +// FhirServiceAcrConfiguration - Azure container registry configuration information +type FhirServiceAcrConfiguration struct { + // The list of the Azure container registry login servers. + LoginServers []*string `json:"loginServers,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FhirServiceAcrConfiguration. +func (f FhirServiceAcrConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loginServers", f.LoginServers) + return json.Marshal(objectMap) +} + +// FhirServiceAuthenticationConfiguration - Authentication configuration information +type FhirServiceAuthenticationConfiguration struct { + // The audience url for the service + Audience *string `json:"audience,omitempty"` + + // The authority url for the service + Authority *string `json:"authority,omitempty"` + + // If the SMART on FHIR proxy is enabled + SmartProxyEnabled *bool `json:"smartProxyEnabled,omitempty"` +} + +// FhirServiceCollection - A collection of Fhir services. +type FhirServiceCollection struct { + // The link used to get the next page of Fhir Services. + NextLink *string `json:"nextLink,omitempty"` + + // The list of Fhir Services. + Value []*FhirService `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FhirServiceCollection. +func (f FhirServiceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// FhirServiceCorsConfiguration - The settings for the CORS configuration of the service instance. +type FhirServiceCorsConfiguration struct { + // If credentials are allowed via CORS. + AllowCredentials *bool `json:"allowCredentials,omitempty"` + + // The headers to be allowed via CORS. + Headers []*string `json:"headers,omitempty"` + + // The max age to be allowed via CORS. + MaxAge *int32 `json:"maxAge,omitempty"` + + // The methods to be allowed via CORS. + Methods []*string `json:"methods,omitempty"` + + // The origins to be allowed via CORS. + Origins []*string `json:"origins,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FhirServiceCorsConfiguration. +func (f FhirServiceCorsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowCredentials", f.AllowCredentials) + populate(objectMap, "headers", f.Headers) + populate(objectMap, "maxAge", f.MaxAge) + populate(objectMap, "methods", f.Methods) + populate(objectMap, "origins", f.Origins) + return json.Marshal(objectMap) +} + +// FhirServiceExportConfiguration - Export operation configuration information +type FhirServiceExportConfiguration struct { + // The name of the default export storage account. + StorageAccountName *string `json:"storageAccountName,omitempty"` +} + +// FhirServicePatchResource - FhirService patch properties +type FhirServicePatchResource struct { + ResourceTags + ServiceManagedIdentity +} + +// FhirServiceProperties - Fhir Service properties. +type FhirServiceProperties struct { + // Fhir Service access policies. + AccessPolicies []*FhirServiceAccessPolicyEntry `json:"accessPolicies,omitempty"` + + // Fhir Service Azure container registry configuration. + AcrConfiguration *FhirServiceAcrConfiguration `json:"acrConfiguration,omitempty"` + + // Fhir Service authentication configuration. + AuthenticationConfiguration *FhirServiceAuthenticationConfiguration `json:"authenticationConfiguration,omitempty"` + + // Fhir Service Cors configuration. + CorsConfiguration *FhirServiceCorsConfiguration `json:"corsConfiguration,omitempty"` + + // Fhir Service export configuration. + ExportConfiguration *FhirServiceExportConfiguration `json:"exportConfiguration,omitempty"` + + // The provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FhirServiceProperties. +func (f FhirServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessPolicies", f.AccessPolicies) + populate(objectMap, "acrConfiguration", f.AcrConfiguration) + populate(objectMap, "authenticationConfiguration", f.AuthenticationConfiguration) + populate(objectMap, "corsConfiguration", f.CorsConfiguration) + populate(objectMap, "exportConfiguration", f.ExportConfiguration) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// FhirServicesBeginCreateOrUpdateOptions contains the optional parameters for the FhirServices.BeginCreateOrUpdate method. +type FhirServicesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// FhirServicesBeginDeleteOptions contains the optional parameters for the FhirServices.BeginDelete method. +type FhirServicesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// FhirServicesBeginUpdateOptions contains the optional parameters for the FhirServices.BeginUpdate method. +type FhirServicesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// FhirServicesGetOptions contains the optional parameters for the FhirServices.Get method. +type FhirServicesGetOptions struct { + // placeholder for future optional parameters +} + +// FhirServicesListByWorkspaceOptions contains the optional parameters for the FhirServices.ListByWorkspace method. +type FhirServicesListByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// IotConnector - IoT Connector definition. +type IotConnector struct { + ServiceManagedIdentity + TaggedResource + // IoT Connector configuration. + Properties *IotConnectorProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type IotConnector. +func (i IotConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.TaggedResource.marshalInternal(objectMap) + i.ServiceManagedIdentity.marshalInternal(objectMap) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + return json.Marshal(objectMap) +} + +// IotConnectorCollection - A collection of IoT Connectors. +type IotConnectorCollection struct { + // The link used to get the next page of IoT Connectors. + NextLink *string `json:"nextLink,omitempty"` + + // The list of IoT Connectors. + Value []*IotConnector `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IotConnectorCollection. +func (i IotConnectorCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// IotConnectorFhirDestinationBeginCreateOrUpdateOptions contains the optional parameters for the IotConnectorFhirDestination.BeginCreateOrUpdate method. +type IotConnectorFhirDestinationBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorFhirDestinationBeginDeleteOptions contains the optional parameters for the IotConnectorFhirDestination.BeginDelete method. +type IotConnectorFhirDestinationBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorFhirDestinationGetOptions contains the optional parameters for the IotConnectorFhirDestination.Get method. +type IotConnectorFhirDestinationGetOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorPatchResource - Iot Connector patch properties +type IotConnectorPatchResource struct { + ResourceTags + ServiceManagedIdentity +} + +// IotConnectorProperties - IoT Connector properties. +type IotConnectorProperties struct { + // Device Mappings. + DeviceMapping *IotMappingProperties `json:"deviceMapping,omitempty"` + + // Source configuration. + IngestionEndpointConfiguration *IotEventHubIngestionEndpointConfiguration `json:"ingestionEndpointConfiguration,omitempty"` + + // The provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} + +// IotConnectorsBeginCreateOrUpdateOptions contains the optional parameters for the IotConnectors.BeginCreateOrUpdate method. +type IotConnectorsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorsBeginDeleteOptions contains the optional parameters for the IotConnectors.BeginDelete method. +type IotConnectorsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorsBeginUpdateOptions contains the optional parameters for the IotConnectors.BeginUpdate method. +type IotConnectorsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorsGetOptions contains the optional parameters for the IotConnectors.Get method. +type IotConnectorsGetOptions struct { + // placeholder for future optional parameters +} + +// IotConnectorsListByWorkspaceOptions contains the optional parameters for the IotConnectors.ListByWorkspace method. +type IotConnectorsListByWorkspaceOptions struct { + // placeholder for future optional parameters +} + +// IotDestinationProperties - Common IoT Connector destination properties. +type IotDestinationProperties struct { + // The provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} + +// IotEventHubIngestionEndpointConfiguration - Event Hub ingestion endpoint configuration +type IotEventHubIngestionEndpointConfiguration struct { + // Consumer group of the event hub to connected to. + ConsumerGroup *string `json:"consumerGroup,omitempty"` + + // Event Hub name to connect to. + EventHubName *string `json:"eventHubName,omitempty"` + + // Fully qualified namespace of the Event Hub to connect to. + FullyQualifiedEventHubNamespace *string `json:"fullyQualifiedEventHubNamespace,omitempty"` +} + +// IotFhirDestination - IoT Connector FHIR destination definition. +type IotFhirDestination struct { + LocationBasedResource + // REQUIRED; IoT FHIR Destination settings. + Properties *IotFhirDestinationProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type IotFhirDestination. +func (i IotFhirDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.LocationBasedResource.marshalInternal(objectMap) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + return json.Marshal(objectMap) +} + +// IotFhirDestinationCollection - A collection of IoT Connector FHIR destinations. +type IotFhirDestinationCollection struct { + // The link used to get the next page of IoT FHIR destinations. + NextLink *string `json:"nextLink,omitempty"` + + // The list of IoT Connector FHIR destinations. + Value []*IotFhirDestination `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IotFhirDestinationCollection. +func (i IotFhirDestinationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// IotFhirDestinationProperties - IoT Connector destination properties for an Azure FHIR service. +type IotFhirDestinationProperties struct { + IotDestinationProperties + // REQUIRED; FHIR Mappings + FhirMapping *IotMappingProperties `json:"fhirMapping,omitempty"` + + // REQUIRED; Fully qualified resource id of the FHIR service to connect to. + FhirServiceResourceID *string `json:"fhirServiceResourceId,omitempty"` + + // REQUIRED; Determines how resource identity is resolved on the destination. + ResourceIdentityResolutionType *IotIdentityResolutionType `json:"resourceIdentityResolutionType,omitempty"` +} + +// IotMappingProperties - The mapping content. +type IotMappingProperties struct { + // The mapping. + Content map[string]interface{} `json:"content,omitempty"` +} + +// ListOperations - Available operations of the service +type ListOperations struct { + // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // READ-ONLY; Collection of available operation details + Value []*OperationDetail `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListOperations. +func (l ListOperations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// LocationBasedResource - The common properties for any location based resource, tracked or proxy. +type LocationBasedResource struct { + ResourceCore + // The resource location. + Location *string `json:"location,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LocationBasedResource. +func (l LocationBasedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + l.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (l LocationBasedResource) marshalInternal(objectMap map[string]interface{}) { + l.ResourceCore.marshalInternal(objectMap) + populate(objectMap, "location", l.Location) +} + +// OperationDetail - Service REST API operation. +type OperationDetail struct { + // Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType `json:"actionType,omitempty" azure:"ro"` + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"` + + // READ-ONLY; Name of the operation + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Default value is 'user,system'. + Origin *string `json:"origin,omitempty" azure:"ro"` +} + +// OperationDisplay - The object that represents the operation. +type OperationDisplay struct { + // READ-ONLY; Friendly description for the operation, + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Name of the operation + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; Service provider: Microsoft.HealthcareApis + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; Resource Type: Services + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationResultsDescription - The properties indicating the operation result of an operation on a service. +type OperationResultsDescription struct { + // Additional properties of the operation result. + Properties map[string]interface{} `json:"properties,omitempty"` + + // READ-ONLY; The ID of the operation returned. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the operation result. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The time that the operation was started. + StartTime *string `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; The status of the operation being performed. + Status *OperationResultStatus `json:"status,omitempty" azure:"ro"` +} + +// OperationResultsGetOptions contains the optional parameters for the OperationResults.Get method. +type OperationResultsGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty" azure:"ro"` +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + Resource + // Resource properties. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// PrivateEndpointConnectionDescription - The Private Endpoint Connection resource. +type PrivateEndpointConnectionDescription struct { + PrivateEndpointConnection + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionListResultDescription - List of private endpoint connection associated with the specified storage account +type PrivateEndpointConnectionListResultDescription struct { + // Array of private endpoint connections + Value []*PrivateEndpointConnectionDescription `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResultDescription. +func (p PrivateEndpointConnectionListResultDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionsBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnections.BeginCreateOrUpdate method. +type PrivateEndpointConnectionsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnections.BeginDelete method. +type PrivateEndpointConnectionsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsGetOptions contains the optional parameters for the PrivateEndpointConnections.Get method. +type PrivateEndpointConnectionsGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsListByServiceOptions contains the optional parameters for the PrivateEndpointConnections.ListByService method. +type PrivateEndpointConnectionsListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + Resource + // Resource properties. + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` +} + +// PrivateLinkResourceDescription - The Private Endpoint Connection resource. +type PrivateLinkResourceDescription struct { + PrivateLinkResource + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// PrivateLinkResourceListResultDescription - A list of private link resources +type PrivateLinkResourceListResultDescription struct { + // Array of private link resources + Value []*PrivateLinkResourceDescription `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResultDescription. +func (p PrivateLinkResourceListResultDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource Private link DNS zone name. + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + + // READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty" azure:"ro"` + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesGetOptions contains the optional parameters for the PrivateLinkResources.Get method. +type PrivateLinkResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesListByServiceOptions contains the optional parameters for the PrivateLinkResources.ListByService method. +type PrivateLinkResourcesListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceCore - The common properties for any resource, tracked or proxy. +type ResourceCore struct { + // An etag associated with the resource, used for optimistic concurrency when editing it. + Etag *string `json:"etag,omitempty"` + + // READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceCore. +func (r ResourceCore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (r ResourceCore) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) +} + +// ResourceTags - List of key value pairs that describe the resource. This will overwrite the existing tags. +type ResourceTags struct { + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceTags. +func (r ResourceTags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (r ResourceTags) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "tags", r.Tags) +} + +// ServiceAccessPolicyEntry - An access policy entry. +type ServiceAccessPolicyEntry struct { + // REQUIRED; An Azure AD object ID (User or Apps) that is allowed access to the FHIR service. + ObjectID *string `json:"objectId,omitempty"` +} + +// ServiceAcrConfigurationInfo - Azure container registry configuration information +type ServiceAcrConfigurationInfo struct { + // The list of the ACR login servers. + LoginServers []*string `json:"loginServers,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceAcrConfigurationInfo. +func (s ServiceAcrConfigurationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loginServers", s.LoginServers) + return json.Marshal(objectMap) +} + +// ServiceAuthenticationConfigurationInfo - Authentication configuration information +type ServiceAuthenticationConfigurationInfo struct { + // The audience url for the service + Audience *string `json:"audience,omitempty"` + + // The authority url for the service + Authority *string `json:"authority,omitempty"` + + // If the SMART on FHIR proxy is enabled + SmartProxyEnabled *bool `json:"smartProxyEnabled,omitempty"` +} + +// ServiceCorsConfigurationInfo - The settings for the CORS configuration of the service instance. +type ServiceCorsConfigurationInfo struct { + // If credentials are allowed via CORS. + AllowCredentials *bool `json:"allowCredentials,omitempty"` + + // The headers to be allowed via CORS. + Headers []*string `json:"headers,omitempty"` + + // The max age to be allowed via CORS. + MaxAge *int32 `json:"maxAge,omitempty"` + + // The methods to be allowed via CORS. + Methods []*string `json:"methods,omitempty"` + + // The origins to be allowed via CORS. + Origins []*string `json:"origins,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceCorsConfigurationInfo. +func (s ServiceCorsConfigurationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowCredentials", s.AllowCredentials) + populate(objectMap, "headers", s.Headers) + populate(objectMap, "maxAge", s.MaxAge) + populate(objectMap, "methods", s.Methods) + populate(objectMap, "origins", s.Origins) + return json.Marshal(objectMap) +} + +// ServiceCosmosDbConfigurationInfo - The settings for the Cosmos DB database backing the service. +type ServiceCosmosDbConfigurationInfo struct { + // The URI of the customer-managed key for the backing database. + KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` + + // The provisioned throughput for the backing database. + OfferThroughput *int32 `json:"offerThroughput,omitempty"` +} + +// ServiceExportConfigurationInfo - Export operation configuration information +type ServiceExportConfigurationInfo struct { + // The name of the default export storage account. + StorageAccountName *string `json:"storageAccountName,omitempty"` +} + +// ServiceManagedIdentity - The managed identity of a service. +type ServiceManagedIdentity struct { + // Setting indicating whether the service has a managed identity associated with it. + Identity *ServiceManagedIdentityIdentity `json:"identity,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceManagedIdentity. +func (s ServiceManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (s ServiceManagedIdentity) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "identity", s.Identity) +} + +// ServiceManagedIdentityIdentity - Setting indicating whether the service has a managed identity associated with it. +type ServiceManagedIdentityIdentity struct { + // Type of identity being specified, currently SystemAssigned and None are allowed. + Type *ManagedServiceIdentityType `json:"type,omitempty"` +} + +// ServicesBeginCreateOrUpdateOptions contains the optional parameters for the Services.BeginCreateOrUpdate method. +type ServicesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServicesBeginDeleteOptions contains the optional parameters for the Services.BeginDelete method. +type ServicesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// ServicesBeginUpdateOptions contains the optional parameters for the Services.BeginUpdate method. +type ServicesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServicesCheckNameAvailabilityOptions contains the optional parameters for the Services.CheckNameAvailability method. +type ServicesCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ServicesDescription - The description of the service. +type ServicesDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServicesDescription. +func (s ServicesDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// ServicesDescriptionListResult - A list of service description objects with a next link. +type ServicesDescriptionListResult struct { + // The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty"` + + // A list of service description objects. + Value []*ServicesDescription `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServicesDescriptionListResult. +func (s ServicesDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// ServicesGetOptions contains the optional parameters for the Services.Get method. +type ServicesGetOptions struct { + // placeholder for future optional parameters +} + +// ServicesListByResourceGroupOptions contains the optional parameters for the Services.ListByResourceGroup method. +type ServicesListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServicesListOptions contains the optional parameters for the Services.List method. +type ServicesListOptions struct { + // placeholder for future optional parameters +} + +// ServicesNameAvailabilityInfo - The properties indicating whether a given service name is available. +type ServicesNameAvailabilityInfo struct { + // The detailed reason message. + Message *string `json:"message,omitempty"` + + // READ-ONLY; The value which indicates whether the provided name is available. + NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` + + // READ-ONLY; The reason for unavailability. + Reason *ServiceNameUnavailabilityReason `json:"reason,omitempty" azure:"ro"` +} + +// ServicesPatchDescription - The description of the service. +type ServicesPatchDescription struct { + // The properties for updating a service instance. + Properties *ServicesPropertiesUpdateParameters `json:"properties,omitempty"` + + // Instance tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServicesPatchDescription. +func (s ServicesPatchDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// ServicesProperties - The properties of a service instance. +type ServicesProperties struct { + // The access policies of the service instance. + AccessPolicies []*ServiceAccessPolicyEntry `json:"accessPolicies,omitempty"` + + // The azure container registry settings used for convert data operation of the service instance. + AcrConfiguration *ServiceAcrConfigurationInfo `json:"acrConfiguration,omitempty"` + + // The authentication configuration for the service instance. + AuthenticationConfiguration *ServiceAuthenticationConfigurationInfo `json:"authenticationConfiguration,omitempty"` + + // The settings for the CORS configuration of the service instance. + CorsConfiguration *ServiceCorsConfigurationInfo `json:"corsConfiguration,omitempty"` + + // The settings for the Cosmos DB database backing the service. + CosmosDbConfiguration *ServiceCosmosDbConfigurationInfo `json:"cosmosDbConfiguration,omitempty"` + + // The settings for the export operation of the service instance. + ExportConfiguration *ServiceExportConfigurationInfo `json:"exportConfiguration,omitempty"` + + // The list of private endpoint connections that are set up for this resource. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + + // Control permission for data plane traffic coming from public networks while private endpoint is enabled. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // READ-ONLY; The provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServicesProperties. +func (s ServicesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessPolicies", s.AccessPolicies) + populate(objectMap, "acrConfiguration", s.AcrConfiguration) + populate(objectMap, "authenticationConfiguration", s.AuthenticationConfiguration) + populate(objectMap, "corsConfiguration", s.CorsConfiguration) + populate(objectMap, "cosmosDbConfiguration", s.CosmosDbConfiguration) + populate(objectMap, "exportConfiguration", s.ExportConfiguration) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// ServicesPropertiesUpdateParameters - The properties for updating a service instance. +type ServicesPropertiesUpdateParameters struct { + // Control permission for data plane traffic coming from public networks while private endpoint is enabled. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// ServicesResource - The common properties of a service. +type ServicesResource struct { + // REQUIRED; The kind of the service. + Kind *Kind `json:"kind,omitempty"` + + // REQUIRED; The resource location. + Location *string `json:"location,omitempty"` + + // An etag associated with the resource, used for optimistic concurrency when editing it. + Etag *string `json:"etag,omitempty"` + + // Setting indicating whether the service has a managed identity associated with it. + Identity *ServicesResourceIdentity `json:"identity,omitempty"` + + // The resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServicesResource. +func (s ServicesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (s ServicesResource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) +} + +// ServicesResourceIdentity - Setting indicating whether the service has a managed identity associated with it. +type ServicesResourceIdentity struct { + // Type of identity being specified, currently SystemAssigned and None are allowed. + Type *ManagedServiceIdentityType `json:"type,omitempty"` + + // READ-ONLY; The principal ID of the resource identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of the resource. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TaggedResource - The common properties of tracked resources in the service. +type TaggedResource struct { + LocationBasedResource + ResourceTags +} + +func (t TaggedResource) marshalInternal(objectMap map[string]interface{}) { + t.ResourceTags.marshalInternal(objectMap) + t.LocationBasedResource.marshalInternal(objectMap) +} + +// Workspace resource. +type Workspace struct { + TaggedResource + // Workspaces resource specific properties. + Properties *WorkspaceProperties `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Workspace. +func (w Workspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + w.TaggedResource.marshalInternal(objectMap) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + return json.Marshal(objectMap) +} + +// WorkspaceList - Collection of workspace object with a next link +type WorkspaceList struct { + // The link used to get the next page. + NextLink *string `json:"nextLink,omitempty"` + + // Collection of resources. + Value []*Workspace `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceList. +func (w WorkspaceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// WorkspacePatchResource - Workspace patch properties +type WorkspacePatchResource struct { + ResourceTags +} + +// WorkspaceProperties - Workspaces resource specific properties. +type WorkspaceProperties struct { + // The provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} + +// WorkspacesBeginCreateOrUpdateOptions contains the optional parameters for the Workspaces.BeginCreateOrUpdate method. +type WorkspacesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesBeginDeleteOptions contains the optional parameters for the Workspaces.BeginDelete method. +type WorkspacesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesBeginUpdateOptions contains the optional parameters for the Workspaces.BeginUpdate method. +type WorkspacesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesGetOptions contains the optional parameters for the Workspaces.Get method. +type WorkspacesGetOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesListByResourceGroupOptions contains the optional parameters for the Workspaces.ListByResourceGroup method. +type WorkspacesListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// WorkspacesListBySubscriptionOptions contains the optional parameters for the Workspaces.ListBySubscription method. +type WorkspacesListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operationresults_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operationresults_client.go new file mode 100644 index 000000000000..e27e82de555e --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operationresults_client.go @@ -0,0 +1,108 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient with the specified values. +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationResultsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationResultsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Get the operation result for a long running operation. +// If the operation fails it returns the *ErrorDetails error type. +func (client *OperationResultsClient) Get(ctx context.Context, locationName string, operationResultID string, options *OperationResultsGetOptions) (OperationResultsGetResponse, error) { + req, err := client.getCreateRequest(ctx, locationName, operationResultID, options) + if err != nil { + return OperationResultsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationResultsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationResultsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, locationName string, operationResultID string, options *OperationResultsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if operationResultID == "" { + return nil, errors.New("parameter operationResultID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationResultId}", url.PathEscape(operationResultID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsGetResponse, error) { + result := OperationResultsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultsDescription); err != nil { + return OperationResultsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *OperationResultsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operations_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operations_client.go new file mode 100644 index 000000000000..4f87ae7d115d --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_operations_client.go @@ -0,0 +1,89 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Lists all of the available operations supported by Microsoft Healthcare resource provider. +// If the operation fails it returns the *ErrorDetails error type. +func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager { + return &OperationsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ListOperations.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HealthcareApis/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListOperations); err != nil { + return OperationsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pagers.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pagers.go new file mode 100644 index 000000000000..c1a7eac5a8de --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pagers.go @@ -0,0 +1,503 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// DicomServicesListByWorkspacePager provides operations for iterating over paged responses. +type DicomServicesListByWorkspacePager struct { + client *DicomServicesClient + current DicomServicesListByWorkspaceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DicomServicesListByWorkspaceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *DicomServicesListByWorkspacePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DicomServicesListByWorkspacePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.DicomServiceCollection.NextLink == nil || len(*p.current.DicomServiceCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByWorkspaceHandleError(resp) + return false + } + result, err := p.client.listByWorkspaceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current DicomServicesListByWorkspaceResponse page. +func (p *DicomServicesListByWorkspacePager) PageResponse() DicomServicesListByWorkspaceResponse { + return p.current +} + +// FhirDestinationsListByIotConnectorPager provides operations for iterating over paged responses. +type FhirDestinationsListByIotConnectorPager struct { + client *FhirDestinationsClient + current FhirDestinationsListByIotConnectorResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, FhirDestinationsListByIotConnectorResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *FhirDestinationsListByIotConnectorPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *FhirDestinationsListByIotConnectorPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.IotFhirDestinationCollection.NextLink == nil || len(*p.current.IotFhirDestinationCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByIotConnectorHandleError(resp) + return false + } + result, err := p.client.listByIotConnectorHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current FhirDestinationsListByIotConnectorResponse page. +func (p *FhirDestinationsListByIotConnectorPager) PageResponse() FhirDestinationsListByIotConnectorResponse { + return p.current +} + +// FhirServicesListByWorkspacePager provides operations for iterating over paged responses. +type FhirServicesListByWorkspacePager struct { + client *FhirServicesClient + current FhirServicesListByWorkspaceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, FhirServicesListByWorkspaceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *FhirServicesListByWorkspacePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *FhirServicesListByWorkspacePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.FhirServiceCollection.NextLink == nil || len(*p.current.FhirServiceCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByWorkspaceHandleError(resp) + return false + } + result, err := p.client.listByWorkspaceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current FhirServicesListByWorkspaceResponse page. +func (p *FhirServicesListByWorkspacePager) PageResponse() FhirServicesListByWorkspaceResponse { + return p.current +} + +// IotConnectorsListByWorkspacePager provides operations for iterating over paged responses. +type IotConnectorsListByWorkspacePager struct { + client *IotConnectorsClient + current IotConnectorsListByWorkspaceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, IotConnectorsListByWorkspaceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *IotConnectorsListByWorkspacePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *IotConnectorsListByWorkspacePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.IotConnectorCollection.NextLink == nil || len(*p.current.IotConnectorCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByWorkspaceHandleError(resp) + return false + } + result, err := p.client.listByWorkspaceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current IotConnectorsListByWorkspaceResponse page. +func (p *IotConnectorsListByWorkspacePager) PageResponse() IotConnectorsListByWorkspaceResponse { + return p.current +} + +// OperationsListPager provides operations for iterating over paged responses. +type OperationsListPager struct { + client *OperationsClient + current OperationsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ListOperations.NextLink == nil || len(*p.current.ListOperations.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsListResponse page. +func (p *OperationsListPager) PageResponse() OperationsListResponse { + return p.current +} + +// ServicesListByResourceGroupPager provides operations for iterating over paged responses. +type ServicesListByResourceGroupPager struct { + client *ServicesClient + current ServicesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ServicesListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ServicesListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ServicesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ServicesDescriptionListResult.NextLink == nil || len(*p.current.ServicesDescriptionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ServicesListByResourceGroupResponse page. +func (p *ServicesListByResourceGroupPager) PageResponse() ServicesListByResourceGroupResponse { + return p.current +} + +// ServicesListPager provides operations for iterating over paged responses. +type ServicesListPager struct { + client *ServicesClient + current ServicesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ServicesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ServicesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ServicesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ServicesDescriptionListResult.NextLink == nil || len(*p.current.ServicesDescriptionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ServicesListResponse page. +func (p *ServicesListPager) PageResponse() ServicesListResponse { + return p.current +} + +// WorkspacesListByResourceGroupPager provides operations for iterating over paged responses. +type WorkspacesListByResourceGroupPager struct { + client *WorkspacesClient + current WorkspacesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WorkspacesListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WorkspacesListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *WorkspacesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.WorkspaceList.NextLink == nil || len(*p.current.WorkspaceList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current WorkspacesListByResourceGroupResponse page. +func (p *WorkspacesListByResourceGroupPager) PageResponse() WorkspacesListByResourceGroupResponse { + return p.current +} + +// WorkspacesListBySubscriptionPager provides operations for iterating over paged responses. +type WorkspacesListBySubscriptionPager struct { + client *WorkspacesClient + current WorkspacesListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, WorkspacesListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *WorkspacesListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *WorkspacesListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.WorkspaceList.NextLink == nil || len(*p.current.WorkspaceList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current WorkspacesListBySubscriptionResponse page. +func (p *WorkspacesListBySubscriptionPager) PageResponse() WorkspacesListBySubscriptionResponse { + return p.current +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pollers.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pollers.go new file mode 100644 index 000000000000..f94cc30fc3bc --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_pollers.go @@ -0,0 +1,832 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// DicomServicesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DicomServicesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DicomServicesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DicomServicesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DicomServicesCreateOrUpdateResponse will be returned. +func (p *DicomServicesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DicomServicesCreateOrUpdateResponse, error) { + respType := DicomServicesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DicomService) + if err != nil { + return DicomServicesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DicomServicesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DicomServicesDeletePoller provides polling facilities until the operation reaches a terminal state. +type DicomServicesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DicomServicesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DicomServicesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DicomServicesDeleteResponse will be returned. +func (p *DicomServicesDeletePoller) FinalResponse(ctx context.Context) (DicomServicesDeleteResponse, error) { + respType := DicomServicesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DicomServicesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DicomServicesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DicomServicesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DicomServicesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DicomServicesUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DicomServicesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DicomServicesUpdateResponse will be returned. +func (p *DicomServicesUpdatePoller) FinalResponse(ctx context.Context) (DicomServicesUpdateResponse, error) { + respType := DicomServicesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DicomService) + if err != nil { + return DicomServicesUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DicomServicesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// FhirServicesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type FhirServicesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *FhirServicesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *FhirServicesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final FhirServicesCreateOrUpdateResponse will be returned. +func (p *FhirServicesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (FhirServicesCreateOrUpdateResponse, error) { + respType := FhirServicesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.FhirService) + if err != nil { + return FhirServicesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *FhirServicesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// FhirServicesDeletePoller provides polling facilities until the operation reaches a terminal state. +type FhirServicesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *FhirServicesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *FhirServicesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final FhirServicesDeleteResponse will be returned. +func (p *FhirServicesDeletePoller) FinalResponse(ctx context.Context) (FhirServicesDeleteResponse, error) { + respType := FhirServicesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return FhirServicesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *FhirServicesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// FhirServicesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type FhirServicesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *FhirServicesUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *FhirServicesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final FhirServicesUpdateResponse will be returned. +func (p *FhirServicesUpdatePoller) FinalResponse(ctx context.Context) (FhirServicesUpdateResponse, error) { + respType := FhirServicesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.FhirService) + if err != nil { + return FhirServicesUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *FhirServicesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// IotConnectorFhirDestinationCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type IotConnectorFhirDestinationCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *IotConnectorFhirDestinationCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *IotConnectorFhirDestinationCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final IotConnectorFhirDestinationCreateOrUpdateResponse will be returned. +func (p *IotConnectorFhirDestinationCreateOrUpdatePoller) FinalResponse(ctx context.Context) (IotConnectorFhirDestinationCreateOrUpdateResponse, error) { + respType := IotConnectorFhirDestinationCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.IotFhirDestination) + if err != nil { + return IotConnectorFhirDestinationCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *IotConnectorFhirDestinationCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// IotConnectorFhirDestinationDeletePoller provides polling facilities until the operation reaches a terminal state. +type IotConnectorFhirDestinationDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *IotConnectorFhirDestinationDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *IotConnectorFhirDestinationDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final IotConnectorFhirDestinationDeleteResponse will be returned. +func (p *IotConnectorFhirDestinationDeletePoller) FinalResponse(ctx context.Context) (IotConnectorFhirDestinationDeleteResponse, error) { + respType := IotConnectorFhirDestinationDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return IotConnectorFhirDestinationDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *IotConnectorFhirDestinationDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// IotConnectorsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type IotConnectorsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *IotConnectorsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *IotConnectorsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final IotConnectorsCreateOrUpdateResponse will be returned. +func (p *IotConnectorsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (IotConnectorsCreateOrUpdateResponse, error) { + respType := IotConnectorsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.IotConnector) + if err != nil { + return IotConnectorsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *IotConnectorsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// IotConnectorsDeletePoller provides polling facilities until the operation reaches a terminal state. +type IotConnectorsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *IotConnectorsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *IotConnectorsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final IotConnectorsDeleteResponse will be returned. +func (p *IotConnectorsDeletePoller) FinalResponse(ctx context.Context) (IotConnectorsDeleteResponse, error) { + respType := IotConnectorsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return IotConnectorsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *IotConnectorsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// IotConnectorsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type IotConnectorsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *IotConnectorsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *IotConnectorsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final IotConnectorsUpdateResponse will be returned. +func (p *IotConnectorsUpdatePoller) FinalResponse(ctx context.Context) (IotConnectorsUpdateResponse, error) { + respType := IotConnectorsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.IotConnector) + if err != nil { + return IotConnectorsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *IotConnectorsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *PrivateEndpointConnectionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final PrivateEndpointConnectionsCreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnectionDescription) + if err != nil { + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *PrivateEndpointConnectionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *PrivateEndpointConnectionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final PrivateEndpointConnectionsDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsDeleteResponse, error) { + respType := PrivateEndpointConnectionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *PrivateEndpointConnectionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ServicesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ServicesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ServicesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ServicesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ServicesCreateOrUpdateResponse will be returned. +func (p *ServicesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ServicesCreateOrUpdateResponse, error) { + respType := ServicesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ServicesDescription) + if err != nil { + return ServicesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ServicesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ServicesDeletePoller provides polling facilities until the operation reaches a terminal state. +type ServicesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ServicesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ServicesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ServicesDeleteResponse will be returned. +func (p *ServicesDeletePoller) FinalResponse(ctx context.Context) (ServicesDeleteResponse, error) { + respType := ServicesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ServicesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ServicesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ServicesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ServicesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ServicesUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ServicesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ServicesUpdateResponse will be returned. +func (p *ServicesUpdatePoller) FinalResponse(ctx context.Context) (ServicesUpdateResponse, error) { + respType := ServicesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ServicesDescription) + if err != nil { + return ServicesUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ServicesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WorkspacesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type WorkspacesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WorkspacesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *WorkspacesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final WorkspacesCreateOrUpdateResponse will be returned. +func (p *WorkspacesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (WorkspacesCreateOrUpdateResponse, error) { + respType := WorkspacesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Workspace) + if err != nil { + return WorkspacesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *WorkspacesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WorkspacesDeletePoller provides polling facilities until the operation reaches a terminal state. +type WorkspacesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WorkspacesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *WorkspacesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final WorkspacesDeleteResponse will be returned. +func (p *WorkspacesDeletePoller) FinalResponse(ctx context.Context) (WorkspacesDeleteResponse, error) { + respType := WorkspacesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return WorkspacesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *WorkspacesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// WorkspacesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type WorkspacesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *WorkspacesUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *WorkspacesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final WorkspacesUpdateResponse will be returned. +func (p *WorkspacesUpdatePoller) FinalResponse(ctx context.Context) (WorkspacesUpdateResponse, error) { + respType := WorkspacesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Workspace) + if err != nil { + return WorkspacesUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *WorkspacesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privateendpointconnections_client.go new file mode 100644 index 000000000000..74eece3bd7a4 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privateendpointconnections_client.go @@ -0,0 +1,337 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Update the state of the specified private endpoint connection associated with the service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsCreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Update the state of the specified private endpoint connection associated with the service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, properties) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (PrivateEndpointConnectionsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *PrivateEndpointConnectionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the specified private endpoint connection associated with the service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (PrivateEndpointConnectionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { + result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionDescription); err != nil { + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByService - Lists all private endpoint connections for a service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsListByServiceOptions) (PrivateEndpointConnectionsListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateEndpointConnectionsListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByServiceResponse, error) { + result := PrivateEndpointConnectionsListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResultDescription); err != nil { + return PrivateEndpointConnectionsListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsClient) listByServiceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privatelinkresources_client.go new file mode 100644 index 000000000000..362339698cda --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_privatelinkresources_client.go @@ -0,0 +1,177 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Gets a private link resource that need to be created for a service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesGetOptions) (PrivateLinkResourcesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupName, options) + if err != nil { + return PrivateLinkResourcesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { + result := PrivateLinkResourcesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceDescription); err != nil { + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByService - Gets the private link resources that need to be created for a service. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkResourcesClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesListByServiceOptions) (PrivateLinkResourcesListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateLinkResourcesClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateLinkResourcesClient) listByServiceHandleResponse(resp *http.Response) (PrivateLinkResourcesListByServiceResponse, error) { + result := PrivateLinkResourcesListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResultDescription); err != nil { + return PrivateLinkResourcesListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateLinkResourcesClient) listByServiceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_response_types.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_response_types.go new file mode 100644 index 000000000000..41dbfbd2babb --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_response_types.go @@ -0,0 +1,1214 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// DicomServicesCreateOrUpdatePollerResponse contains the response from method DicomServices.CreateOrUpdate. +type DicomServicesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DicomServicesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DicomServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DicomServicesCreateOrUpdateResponse, error) { + respType := DicomServicesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DicomService) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DicomServicesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *DicomServicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DicomServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DicomServicesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &DicomServicesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DicomServicesCreateOrUpdateResponse contains the response from method DicomServices.CreateOrUpdate. +type DicomServicesCreateOrUpdateResponse struct { + DicomServicesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DicomServicesCreateOrUpdateResult contains the result from method DicomServices.CreateOrUpdate. +type DicomServicesCreateOrUpdateResult struct { + DicomService +} + +// DicomServicesDeletePollerResponse contains the response from method DicomServices.Delete. +type DicomServicesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *DicomServicesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DicomServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DicomServicesDeleteResponse, error) { + respType := DicomServicesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DicomServicesDeletePollerResponse from the provided client and resume token. +func (l *DicomServicesDeletePollerResponse) Resume(ctx context.Context, client *DicomServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DicomServicesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DicomServicesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DicomServicesDeleteResponse contains the response from method DicomServices.Delete. +type DicomServicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DicomServicesGetResponse contains the response from method DicomServices.Get. +type DicomServicesGetResponse struct { + DicomServicesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DicomServicesGetResult contains the result from method DicomServices.Get. +type DicomServicesGetResult struct { + DicomService +} + +// DicomServicesListByWorkspaceResponse contains the response from method DicomServices.ListByWorkspace. +type DicomServicesListByWorkspaceResponse struct { + DicomServicesListByWorkspaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DicomServicesListByWorkspaceResult contains the result from method DicomServices.ListByWorkspace. +type DicomServicesListByWorkspaceResult struct { + DicomServiceCollection +} + +// DicomServicesUpdatePollerResponse contains the response from method DicomServices.Update. +type DicomServicesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DicomServicesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DicomServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DicomServicesUpdateResponse, error) { + respType := DicomServicesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DicomService) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DicomServicesUpdatePollerResponse from the provided client and resume token. +func (l *DicomServicesUpdatePollerResponse) Resume(ctx context.Context, client *DicomServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DicomServicesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &DicomServicesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DicomServicesUpdateResponse contains the response from method DicomServices.Update. +type DicomServicesUpdateResponse struct { + DicomServicesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DicomServicesUpdateResult contains the result from method DicomServices.Update. +type DicomServicesUpdateResult struct { + DicomService +} + +// FhirDestinationsListByIotConnectorResponse contains the response from method FhirDestinations.ListByIotConnector. +type FhirDestinationsListByIotConnectorResponse struct { + FhirDestinationsListByIotConnectorResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FhirDestinationsListByIotConnectorResult contains the result from method FhirDestinations.ListByIotConnector. +type FhirDestinationsListByIotConnectorResult struct { + IotFhirDestinationCollection +} + +// FhirServicesCreateOrUpdatePollerResponse contains the response from method FhirServices.CreateOrUpdate. +type FhirServicesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *FhirServicesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l FhirServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FhirServicesCreateOrUpdateResponse, error) { + respType := FhirServicesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FhirService) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a FhirServicesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *FhirServicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *FhirServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("FhirServicesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &FhirServicesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// FhirServicesCreateOrUpdateResponse contains the response from method FhirServices.CreateOrUpdate. +type FhirServicesCreateOrUpdateResponse struct { + FhirServicesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FhirServicesCreateOrUpdateResult contains the result from method FhirServices.CreateOrUpdate. +type FhirServicesCreateOrUpdateResult struct { + FhirService +} + +// FhirServicesDeletePollerResponse contains the response from method FhirServices.Delete. +type FhirServicesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *FhirServicesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l FhirServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FhirServicesDeleteResponse, error) { + respType := FhirServicesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a FhirServicesDeletePollerResponse from the provided client and resume token. +func (l *FhirServicesDeletePollerResponse) Resume(ctx context.Context, client *FhirServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("FhirServicesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &FhirServicesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// FhirServicesDeleteResponse contains the response from method FhirServices.Delete. +type FhirServicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FhirServicesGetResponse contains the response from method FhirServices.Get. +type FhirServicesGetResponse struct { + FhirServicesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FhirServicesGetResult contains the result from method FhirServices.Get. +type FhirServicesGetResult struct { + FhirService +} + +// FhirServicesListByWorkspaceResponse contains the response from method FhirServices.ListByWorkspace. +type FhirServicesListByWorkspaceResponse struct { + FhirServicesListByWorkspaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FhirServicesListByWorkspaceResult contains the result from method FhirServices.ListByWorkspace. +type FhirServicesListByWorkspaceResult struct { + FhirServiceCollection +} + +// FhirServicesUpdatePollerResponse contains the response from method FhirServices.Update. +type FhirServicesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *FhirServicesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l FhirServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FhirServicesUpdateResponse, error) { + respType := FhirServicesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FhirService) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a FhirServicesUpdatePollerResponse from the provided client and resume token. +func (l *FhirServicesUpdatePollerResponse) Resume(ctx context.Context, client *FhirServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("FhirServicesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &FhirServicesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// FhirServicesUpdateResponse contains the response from method FhirServices.Update. +type FhirServicesUpdateResponse struct { + FhirServicesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FhirServicesUpdateResult contains the result from method FhirServices.Update. +type FhirServicesUpdateResult struct { + FhirService +} + +// IotConnectorFhirDestinationCreateOrUpdatePollerResponse contains the response from method IotConnectorFhirDestination.CreateOrUpdate. +type IotConnectorFhirDestinationCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *IotConnectorFhirDestinationCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l IotConnectorFhirDestinationCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotConnectorFhirDestinationCreateOrUpdateResponse, error) { + respType := IotConnectorFhirDestinationCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IotFhirDestination) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a IotConnectorFhirDestinationCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *IotConnectorFhirDestinationCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *IotConnectorFhirDestinationClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("IotConnectorFhirDestinationClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &IotConnectorFhirDestinationCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// IotConnectorFhirDestinationCreateOrUpdateResponse contains the response from method IotConnectorFhirDestination.CreateOrUpdate. +type IotConnectorFhirDestinationCreateOrUpdateResponse struct { + IotConnectorFhirDestinationCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorFhirDestinationCreateOrUpdateResult contains the result from method IotConnectorFhirDestination.CreateOrUpdate. +type IotConnectorFhirDestinationCreateOrUpdateResult struct { + IotFhirDestination +} + +// IotConnectorFhirDestinationDeletePollerResponse contains the response from method IotConnectorFhirDestination.Delete. +type IotConnectorFhirDestinationDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *IotConnectorFhirDestinationDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l IotConnectorFhirDestinationDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotConnectorFhirDestinationDeleteResponse, error) { + respType := IotConnectorFhirDestinationDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a IotConnectorFhirDestinationDeletePollerResponse from the provided client and resume token. +func (l *IotConnectorFhirDestinationDeletePollerResponse) Resume(ctx context.Context, client *IotConnectorFhirDestinationClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("IotConnectorFhirDestinationClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &IotConnectorFhirDestinationDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// IotConnectorFhirDestinationDeleteResponse contains the response from method IotConnectorFhirDestination.Delete. +type IotConnectorFhirDestinationDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorFhirDestinationGetResponse contains the response from method IotConnectorFhirDestination.Get. +type IotConnectorFhirDestinationGetResponse struct { + IotConnectorFhirDestinationGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorFhirDestinationGetResult contains the result from method IotConnectorFhirDestination.Get. +type IotConnectorFhirDestinationGetResult struct { + IotFhirDestination +} + +// IotConnectorsCreateOrUpdatePollerResponse contains the response from method IotConnectors.CreateOrUpdate. +type IotConnectorsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *IotConnectorsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l IotConnectorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotConnectorsCreateOrUpdateResponse, error) { + respType := IotConnectorsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IotConnector) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a IotConnectorsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *IotConnectorsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *IotConnectorsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("IotConnectorsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &IotConnectorsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// IotConnectorsCreateOrUpdateResponse contains the response from method IotConnectors.CreateOrUpdate. +type IotConnectorsCreateOrUpdateResponse struct { + IotConnectorsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorsCreateOrUpdateResult contains the result from method IotConnectors.CreateOrUpdate. +type IotConnectorsCreateOrUpdateResult struct { + IotConnector +} + +// IotConnectorsDeletePollerResponse contains the response from method IotConnectors.Delete. +type IotConnectorsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *IotConnectorsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l IotConnectorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotConnectorsDeleteResponse, error) { + respType := IotConnectorsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a IotConnectorsDeletePollerResponse from the provided client and resume token. +func (l *IotConnectorsDeletePollerResponse) Resume(ctx context.Context, client *IotConnectorsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("IotConnectorsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &IotConnectorsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// IotConnectorsDeleteResponse contains the response from method IotConnectors.Delete. +type IotConnectorsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorsGetResponse contains the response from method IotConnectors.Get. +type IotConnectorsGetResponse struct { + IotConnectorsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorsGetResult contains the result from method IotConnectors.Get. +type IotConnectorsGetResult struct { + IotConnector +} + +// IotConnectorsListByWorkspaceResponse contains the response from method IotConnectors.ListByWorkspace. +type IotConnectorsListByWorkspaceResponse struct { + IotConnectorsListByWorkspaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorsListByWorkspaceResult contains the result from method IotConnectors.ListByWorkspace. +type IotConnectorsListByWorkspaceResult struct { + IotConnectorCollection +} + +// IotConnectorsUpdatePollerResponse contains the response from method IotConnectors.Update. +type IotConnectorsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *IotConnectorsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l IotConnectorsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotConnectorsUpdateResponse, error) { + respType := IotConnectorsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IotConnector) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a IotConnectorsUpdatePollerResponse from the provided client and resume token. +func (l *IotConnectorsUpdatePollerResponse) Resume(ctx context.Context, client *IotConnectorsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("IotConnectorsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &IotConnectorsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// IotConnectorsUpdateResponse contains the response from method IotConnectors.Update. +type IotConnectorsUpdateResponse struct { + IotConnectorsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// IotConnectorsUpdateResult contains the result from method IotConnectors.Update. +type IotConnectorsUpdateResult struct { + IotConnector +} + +// OperationResultsGetResponse contains the response from method OperationResults.Get. +type OperationResultsGetResponse struct { + OperationResultsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationResultsGetResult contains the result from method OperationResults.Get. +type OperationResultsGetResult struct { + OperationResultsDescription +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + ListOperations +} + +// PrivateEndpointConnectionsCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnections.CreateOrUpdate. +type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnectionDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsCreateOrUpdateResponse contains the response from method PrivateEndpointConnections.CreateOrUpdate. +type PrivateEndpointConnectionsCreateOrUpdateResponse struct { + PrivateEndpointConnectionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsCreateOrUpdateResult contains the result from method PrivateEndpointConnections.CreateOrUpdate. +type PrivateEndpointConnectionsCreateOrUpdateResult struct { + PrivateEndpointConnectionDescription +} + +// PrivateEndpointConnectionsDeletePollerResponse contains the response from method PrivateEndpointConnections.Delete. +type PrivateEndpointConnectionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { + respType := PrivateEndpointConnectionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsDeleteResponse contains the response from method PrivateEndpointConnections.Delete. +type PrivateEndpointConnectionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsGetResponse contains the response from method PrivateEndpointConnections.Get. +type PrivateEndpointConnectionsGetResponse struct { + PrivateEndpointConnectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsGetResult contains the result from method PrivateEndpointConnections.Get. +type PrivateEndpointConnectionsGetResult struct { + PrivateEndpointConnectionDescription +} + +// PrivateEndpointConnectionsListByServiceResponse contains the response from method PrivateEndpointConnections.ListByService. +type PrivateEndpointConnectionsListByServiceResponse struct { + PrivateEndpointConnectionsListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsListByServiceResult contains the result from method PrivateEndpointConnections.ListByService. +type PrivateEndpointConnectionsListByServiceResult struct { + PrivateEndpointConnectionListResultDescription +} + +// PrivateLinkResourcesGetResponse contains the response from method PrivateLinkResources.Get. +type PrivateLinkResourcesGetResponse struct { + PrivateLinkResourcesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesGetResult contains the result from method PrivateLinkResources.Get. +type PrivateLinkResourcesGetResult struct { + PrivateLinkResourceDescription +} + +// PrivateLinkResourcesListByServiceResponse contains the response from method PrivateLinkResources.ListByService. +type PrivateLinkResourcesListByServiceResponse struct { + PrivateLinkResourcesListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesListByServiceResult contains the result from method PrivateLinkResources.ListByService. +type PrivateLinkResourcesListByServiceResult struct { + PrivateLinkResourceListResultDescription +} + +// ServicesCheckNameAvailabilityResponse contains the response from method Services.CheckNameAvailability. +type ServicesCheckNameAvailabilityResponse struct { + ServicesCheckNameAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesCheckNameAvailabilityResult contains the result from method Services.CheckNameAvailability. +type ServicesCheckNameAvailabilityResult struct { + ServicesNameAvailabilityInfo +} + +// ServicesCreateOrUpdatePollerResponse contains the response from method Services.CreateOrUpdate. +type ServicesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ServicesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesCreateOrUpdateResponse, error) { + respType := ServicesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServicesDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ServicesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ServicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ServicesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &ServicesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ServicesCreateOrUpdateResponse contains the response from method Services.CreateOrUpdate. +type ServicesCreateOrUpdateResponse struct { + ServicesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesCreateOrUpdateResult contains the result from method Services.CreateOrUpdate. +type ServicesCreateOrUpdateResult struct { + ServicesDescription +} + +// ServicesDeletePollerResponse contains the response from method Services.Delete. +type ServicesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ServicesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesDeleteResponse, error) { + respType := ServicesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ServicesDeletePollerResponse from the provided client and resume token. +func (l *ServicesDeletePollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ServicesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &ServicesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ServicesDeleteResponse contains the response from method Services.Delete. +type ServicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesGetResponse contains the response from method Services.Get. +type ServicesGetResponse struct { + ServicesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesGetResult contains the result from method Services.Get. +type ServicesGetResult struct { + ServicesDescription +} + +// ServicesListByResourceGroupResponse contains the response from method Services.ListByResourceGroup. +type ServicesListByResourceGroupResponse struct { + ServicesListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesListByResourceGroupResult contains the result from method Services.ListByResourceGroup. +type ServicesListByResourceGroupResult struct { + ServicesDescriptionListResult +} + +// ServicesListResponse contains the response from method Services.List. +type ServicesListResponse struct { + ServicesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesListResult contains the result from method Services.List. +type ServicesListResult struct { + ServicesDescriptionListResult +} + +// ServicesUpdatePollerResponse contains the response from method Services.Update. +type ServicesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ServicesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesUpdateResponse, error) { + respType := ServicesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServicesDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ServicesUpdatePollerResponse from the provided client and resume token. +func (l *ServicesUpdatePollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ServicesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &ServicesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ServicesUpdateResponse contains the response from method Services.Update. +type ServicesUpdateResponse struct { + ServicesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesUpdateResult contains the result from method Services.Update. +type ServicesUpdateResult struct { + ServicesDescription +} + +// WorkspacesCreateOrUpdatePollerResponse contains the response from method Workspaces.CreateOrUpdate. +type WorkspacesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *WorkspacesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l WorkspacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesCreateOrUpdateResponse, error) { + respType := WorkspacesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Workspace) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WorkspacesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *WorkspacesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &WorkspacesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WorkspacesCreateOrUpdateResponse contains the response from method Workspaces.CreateOrUpdate. +type WorkspacesCreateOrUpdateResponse struct { + WorkspacesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WorkspacesCreateOrUpdateResult contains the result from method Workspaces.CreateOrUpdate. +type WorkspacesCreateOrUpdateResult struct { + Workspace +} + +// WorkspacesDeletePollerResponse contains the response from method Workspaces.Delete. +type WorkspacesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *WorkspacesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l WorkspacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesDeleteResponse, error) { + respType := WorkspacesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WorkspacesDeletePollerResponse from the provided client and resume token. +func (l *WorkspacesDeletePollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &WorkspacesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WorkspacesDeleteResponse contains the response from method Workspaces.Delete. +type WorkspacesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WorkspacesGetResponse contains the response from method Workspaces.Get. +type WorkspacesGetResponse struct { + WorkspacesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WorkspacesGetResult contains the result from method Workspaces.Get. +type WorkspacesGetResult struct { + Workspace +} + +// WorkspacesListByResourceGroupResponse contains the response from method Workspaces.ListByResourceGroup. +type WorkspacesListByResourceGroupResponse struct { + WorkspacesListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WorkspacesListByResourceGroupResult contains the result from method Workspaces.ListByResourceGroup. +type WorkspacesListByResourceGroupResult struct { + WorkspaceList +} + +// WorkspacesListBySubscriptionResponse contains the response from method Workspaces.ListBySubscription. +type WorkspacesListBySubscriptionResponse struct { + WorkspacesListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WorkspacesListBySubscriptionResult contains the result from method Workspaces.ListBySubscription. +type WorkspacesListBySubscriptionResult struct { + WorkspaceList +} + +// WorkspacesUpdatePollerResponse contains the response from method Workspaces.Update. +type WorkspacesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *WorkspacesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l WorkspacesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesUpdateResponse, error) { + respType := WorkspacesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Workspace) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a WorkspacesUpdatePollerResponse from the provided client and resume token. +func (l *WorkspacesUpdatePollerResponse) Resume(ctx context.Context, client *WorkspacesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("WorkspacesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &WorkspacesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// WorkspacesUpdateResponse contains the response from method Workspaces.Update. +type WorkspacesUpdateResponse struct { + WorkspacesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// WorkspacesUpdateResult contains the result from method Workspaces.Update. +type WorkspacesUpdateResult struct { + Workspace +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_services_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_services_client.go new file mode 100644 index 000000000000..8cbf67e9d881 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_services_client.go @@ -0,0 +1,505 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServicesClient contains the methods for the Services group. +// Don't use this type directly, use NewServicesClient() instead. +type ServicesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewServicesClient creates a new instance of ServicesClient with the specified values. +func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// CheckNameAvailability - Check if a service instance name is available. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInputs CheckNameAvailabilityParameters, options *ServicesCheckNameAvailabilityOptions) (ServicesCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityInputs, options) + if err != nil { + return ServicesCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServicesCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServicesCheckNameAvailabilityResponse{}, client.checkNameAvailabilityHandleError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Context, checkNameAvailabilityInputs CheckNameAvailabilityParameters, options *ServicesCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, checkNameAvailabilityInputs) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ServicesCheckNameAvailabilityResponse, error) { + result := ServicesCheckNameAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServicesNameAvailabilityInfo); err != nil { + return ServicesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// checkNameAvailabilityHandleError handles the CheckNameAvailability error response. +func (client *ServicesClient) checkNameAvailabilityHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginCreateOrUpdate - Create or update the metadata of a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, serviceDescription ServicesDescription, options *ServicesBeginCreateOrUpdateOptions) (ServicesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, serviceDescription, options) + if err != nil { + return ServicesCreateOrUpdatePollerResponse{}, err + } + result := ServicesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ServicesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return ServicesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &ServicesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, serviceDescription ServicesDescription, options *ServicesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, serviceDescription, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, serviceDescription ServicesDescription, options *ServicesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, serviceDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *ServicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ServicesBeginDeleteOptions) (ServicesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ServicesDeletePollerResponse{}, err + } + result := ServicesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ServicesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return ServicesDeletePollerResponse{}, err + } + result.Poller = &ServicesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ServicesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ServicesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *ServicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the metadata of a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ServicesGetOptions) (ServicesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ServicesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServicesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServicesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ServicesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesGetResponse, error) { + result := ServicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServicesDescription); err != nil { + return ServicesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *ServicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Get all the service instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) List(options *ServicesListOptions) *ServicesListPager { + return &ServicesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp ServicesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ServicesDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *ServicesClient) listCreateRequest(ctx context.Context, options *ServicesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ServicesClient) listHandleResponse(resp *http.Response) (ServicesListResponse, error) { + result := ServicesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServicesDescriptionListResult); err != nil { + return ServicesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *ServicesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Get all the service instances in a resource group. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) ListByResourceGroup(resourceGroupName string, options *ServicesListByResourceGroupOptions) *ServicesListByResourceGroupPager { + return &ServicesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp ServicesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ServicesDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServicesListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ServicesListByResourceGroupResponse, error) { + result := ServicesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServicesDescriptionListResult); err != nil { + return ServicesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *ServicesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Update the metadata of a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *ServicesBeginUpdateOptions) (ServicesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return ServicesUpdatePollerResponse{}, err + } + result := ServicesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ServicesClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return ServicesUpdatePollerResponse{}, err + } + result.Poller = &ServicesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *ServicesClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *ServicesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *ServicesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, servicePatchDescription) +} + +// updateHandleError handles the Update error response. +func (client *ServicesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_time_rfc3339.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..bda799778691 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_workspaces_client.go b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_workspaces_client.go new file mode 100644 index 000000000000..c7ec7bfc9614 --- /dev/null +++ b/sdk/resourcemanager/healthcareapis/armhealthcareapis/zz_generated_workspaces_client.go @@ -0,0 +1,448 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armhealthcareapis + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkspacesClient contains the methods for the Workspaces group. +// Don't use this type directly, use NewWorkspacesClient() instead. +type WorkspacesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewWorkspacesClient creates a new instance of WorkspacesClient with the specified values. +func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkspacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates a workspace resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace, options *WorkspacesBeginCreateOrUpdateOptions) (WorkspacesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, workspaceName, workspace, options) + if err != nil { + return WorkspacesCreateOrUpdatePollerResponse{}, err + } + result := WorkspacesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WorkspacesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return WorkspacesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &WorkspacesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates a workspace resource with the specified parameters. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace, options *WorkspacesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, workspace, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkspacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace, options *WorkspacesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, workspace) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *WorkspacesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a specified workspace. +// If the operation fails it returns the *Error error type. +func (client *WorkspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesBeginDeleteOptions) (WorkspacesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return WorkspacesDeletePollerResponse{}, err + } + result := WorkspacesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WorkspacesClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return WorkspacesDeletePollerResponse{}, err + } + result.Poller = &WorkspacesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a specified workspace. +// If the operation fails it returns the *Error error type. +func (client *WorkspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *WorkspacesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the properties of the specified workspace. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesGetOptions) (WorkspacesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return WorkspacesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkspacesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkspacesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WorkspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *WorkspacesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (WorkspacesGetResponse, error) { + result := WorkspacesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil { + return WorkspacesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *WorkspacesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Lists all the available workspaces under the specified resource group. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) ListByResourceGroup(resourceGroupName string, options *WorkspacesListByResourceGroupOptions) *WorkspacesListByResourceGroupPager { + return &WorkspacesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp WorkspacesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.WorkspaceList.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *WorkspacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *WorkspacesListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkspacesListByResourceGroupResponse, error) { + result := WorkspacesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceList); err != nil { + return WorkspacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *WorkspacesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Lists all the available workspaces under the specified subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) ListBySubscription(options *WorkspacesListBySubscriptionOptions) *WorkspacesListBySubscriptionPager { + return &WorkspacesListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp WorkspacesListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.WorkspaceList.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *WorkspacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *WorkspacesListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *WorkspacesClient) listBySubscriptionHandleResponse(resp *http.Response) (WorkspacesListBySubscriptionResponse, error) { + result := WorkspacesListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceList); err != nil { + return WorkspacesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *WorkspacesClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Patch workspace details. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchResource WorkspacePatchResource, options *WorkspacesBeginUpdateOptions) (WorkspacesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, workspaceName, workspacePatchResource, options) + if err != nil { + return WorkspacesUpdatePollerResponse{}, err + } + result := WorkspacesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("WorkspacesClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return WorkspacesUpdatePollerResponse{}, err + } + result.Poller = &WorkspacesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch workspace details. +// If the operation fails it returns the *ErrorDetails error type. +func (client *WorkspacesClient) update(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchResource WorkspacePatchResource, options *WorkspacesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, workspaceName, workspacePatchResource, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *WorkspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchResource WorkspacePatchResource, options *WorkspacesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, workspacePatchResource) +} + +// updateHandleError handles the Update error response. +func (client *WorkspacesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorDetails{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +}