From 1aa06f8b2a817cc144adc9e6febd1518ef24022a Mon Sep 17 00:00:00 2001 From: 804873052 <804873052@qq.com> Date: Tue, 7 Dec 2021 14:10:16 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/0.1.0 generation from spec commit: cf36bdc6bc70308a3f05f6399efe21a0e1e9b7d8 --- .../armm365securityandcompliance/CHANGELOG.md | 5 + .../armm365securityandcompliance/LICENSE.txt | 21 + .../armm365securityandcompliance/README.md | 75 + .../armm365securityandcompliance/autorest.md | 13 + .../armm365securityandcompliance/build.go | 7 + .../armm365securityandcompliance/ci.yml | 27 + .../armm365securityandcompliance/go.mod | 9 + .../armm365securityandcompliance/go.sum | 45 + .../go_mod_tidy_hack.go | 13 + ...ed_example_operationresults_client_test.go | 35 + ...enerated_example_operations_client_test.go | 33 + ...teendpointconnectionsadtapi_client_test.go | 113 + ...vateendpointconnectionscomp_client_test.go | 113 + ...teendpointconnectionsforedm_client_test.go | 113 + ...connectionsformippolicysync_client_test.go | 113 + ...connectionsforsccpowershell_client_test.go | 113 + ...ivateendpointconnectionssec_client_test.go | 113 + ...xample_privatelinkresources_client_test.go | 53 + ..._privatelinkresourcesadtapi_client_test.go | 53 + ...le_privatelinkresourcescomp_client_test.go | 53 + ...nkresourcesformippolicysync_client_test.go | 53 + ...nkresourcesforsccpowershell_client_test.go | 53 + ...ple_privatelinkresourcessec_client_test.go | 53 + ...atelinkservicesforedmupload_client_test.go | 128 ++ ...icesform365compliancecenter_client_test.go | 149 ++ ...rvicesform365securitycenter_client_test.go | 149 ++ ...inkservicesformippolicysync_client_test.go | 149 ++ ...oro365managementactivityapi_client_test.go | 149 ++ ...inkservicesforsccpowershell_client_test.go | 149 ++ ..._generated_example_services_client_test.go | 40 + .../zz_generated_constants.go | 214 ++ .../zz_generated_models.go | 1089 +++++++++ .../zz_generated_operationresults_client.go | 108 + .../zz_generated_operations_client.go | 89 + .../zz_generated_pagers.go | 1043 +++++++++ .../zz_generated_pollers.go | 1305 +++++++++++ ...privateendpointconnectionsadtapi_client.go | 334 +++ ...d_privateendpointconnectionscomp_client.go | 334 +++ ...privateendpointconnectionsforedm_client.go | 334 +++ ...pointconnectionsformippolicysync_client.go | 334 +++ ...pointconnectionsforsccpowershell_client.go | 334 +++ ...ed_privateendpointconnectionssec_client.go | 334 +++ ...z_generated_privatelinkresources_client.go | 177 ++ ...rated_privatelinkresourcesadtapi_client.go | 177 ++ ...nerated_privatelinkresourcescomp_client.go | 177 ++ ...atelinkresourcesformippolicysync_client.go | 177 ++ ...atelinkresourcesforsccpowershell_client.go | 177 ++ ...enerated_privatelinkresourcessec_client.go | 177 ++ ..._privatelinkservicesforedmupload_client.go | 372 +++ ...kservicesform365compliancecenter_client.go | 448 ++++ ...inkservicesform365securitycenter_client.go | 448 ++++ ...vatelinkservicesformippolicysync_client.go | 448 ++++ ...icesforo365managementactivityapi_client.go | 448 ++++ ...vatelinkservicesforsccpowershell_client.go | 448 ++++ .../zz_generated_response_types.go | 2032 +++++++++++++++++ .../zz_generated_services_client.go | 119 + .../zz_generated_time_rfc3339.go | 85 + 57 files changed, 13954 insertions(+) create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/CHANGELOG.md create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/LICENSE.txt create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/README.md create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/autorest.md create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/build.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ci.yml create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.mod create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.sum create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_operationresults_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_operations_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsadtapi_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionscomp_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforedm_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsformippolicysync_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforsccpowershell_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionssec_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresources_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesadtapi_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcescomp_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesformippolicysync_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesforsccpowershell_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcessec_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforedmupload_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365compliancecenter_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365securitycenter_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesformippolicysync_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforo365managementactivityapi_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforsccpowershell_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_services_client_test.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_constants.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_models.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_operationresults_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsadtapi_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionscomp_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforedm_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsformippolicysync_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforsccpowershell_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionssec_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresources_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesadtapi_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcescomp_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesformippolicysync_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesforsccpowershell_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcessec_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforedmupload_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365compliancecenter_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365securitycenter_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesformippolicysync_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforo365managementactivityapi_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforsccpowershell_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_services_client.go create mode 100644 sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_time_rfc3339.go diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/CHANGELOG.md b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/CHANGELOG.md new file mode 100644 index 000000000000..925a954ff70d --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-07) + +- Init release. \ No newline at end of file diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/LICENSE.txt b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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/m365securityandcompliance/armm365securityandcompliance/README.md b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/README.md new file mode 100644 index 000000000000..b1d92eded777 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/README.md @@ -0,0 +1,75 @@ +# Azure Directory and Database Infrastructure Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance) + +The `armm365securityandcompliance` module provides operations for working with Azure Directory and Database Infrastructure. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance) + +# 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 Directory and Database Infrastructure module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Directory and Database Infrastructure. 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 Directory and Database Infrastructure 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 := armm365securityandcompliance.NewPrivateEndpointConnectionsForMIPPolicySyncClient(, 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 := armm365securityandcompliance.NewPrivateEndpointConnectionsForMIPPolicySyncClient(, 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 `Directory and Database Infrastructure` 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/m365securityandcompliance/armm365securityandcompliance/autorest.md b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/autorest.md new file mode 100644 index 000000000000..ebef1671a4ba --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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/cf36bdc6bc70308a3f05f6399efe21a0e1e9b7d8/specification/m365securityandcompliance/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/cf36bdc6bc70308a3f05f6399efe21a0e1e9b7d8/specification/m365securityandcompliance/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/m365securityandcompliance/armm365securityandcompliance/build.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/build.go new file mode 100644 index 000000000000..671ebbf17756 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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/m365securityandcompliance/armm365securityandcompliance + +package armm365securityandcompliance diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ci.yml b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ci.yml new file mode 100644 index 000000000000..fddab47d5e9f --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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/m365securityandcompliance/armm365securityandcompliance/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/m365securityandcompliance/armm365securityandcompliance' diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.mod b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.mod new file mode 100644 index 000000000000..1c1c8d6d1e9f --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.mod @@ -0,0 +1,9 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v60.0.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/m365securityandcompliance/armm365securityandcompliance/go.sum b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.sum new file mode 100644 index 000000000000..ac069c64ed64 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go.sum @@ -0,0 +1,45 @@ +github.com/Azure/azure-sdk-for-go v60.0.0+incompatible h1:vVRJhSSTwhIHQTzTjqoZCItFJeBwfdNSqHcgGV10FHQ= +github.com/Azure/azure-sdk-for-go v60.0.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/m365securityandcompliance/armm365securityandcompliance/go_mod_tidy_hack.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/go_mod_tidy_hack.go new file mode 100644 index 000000000000..54c16a77b5fa --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance + +// 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_operationresults_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_operationresults_client_test.go new file mode 100644 index 000000000000..03b0fb28d300 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-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 := armm365securityandcompliance.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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_operations_client_test.go new file mode 100644 index 000000000000..ca1a9e9ce982 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterOperationsList.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 := armm365securityandcompliance.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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsadtapi_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsadtapi_client_test.go new file mode 100644 index 000000000000..e76c9f99cb30 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsadtapi_client_test.go @@ -0,0 +1,113 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsAdtAPIClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsAdtAPIClient("", cred, nil) + pager := client.ListByService("", + "", + 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("PrivateEndpointConnection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsAdtAPIClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsAdtAPIClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsAdtAPIClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsAdtAPIClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armm365securityandcompliance.PrivateEndpointConnection{ + Properties: &armm365securityandcompliance.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armm365securityandcompliance.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armm365securityandcompliance.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("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsAdtAPIClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsAdtAPIClient("", 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionscomp_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionscomp_client_test.go new file mode 100644 index 000000000000..3431e3ec7f07 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionscomp_client_test.go @@ -0,0 +1,113 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsCompClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsCompClient("", cred, nil) + pager := client.ListByService("", + "", + 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("PrivateEndpointConnection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsCompClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsCompClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsCompClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsCompClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armm365securityandcompliance.PrivateEndpointConnection{ + Properties: &armm365securityandcompliance.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armm365securityandcompliance.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armm365securityandcompliance.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("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsCompClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsCompClient("", 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforedm_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforedm_client_test.go new file mode 100644 index 000000000000..3484f2dc19b0 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforedm_client_test.go @@ -0,0 +1,113 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsForEDMClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForEDMClient("", cred, nil) + pager := client.ListByService("", + "", + 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("PrivateEndpointConnection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForEDMClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForEDMClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForEDMClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForEDMClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armm365securityandcompliance.PrivateEndpointConnection{ + Properties: &armm365securityandcompliance.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armm365securityandcompliance.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armm365securityandcompliance.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("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForEDMClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForEDMClient("", 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsformippolicysync_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsformippolicysync_client_test.go new file mode 100644 index 000000000000..24109184f148 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsformippolicysync_client_test.go @@ -0,0 +1,113 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsForMIPPolicySyncClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForMIPPolicySyncClient("", cred, nil) + pager := client.ListByService("", + "", + 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("PrivateEndpointConnection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForMIPPolicySyncClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForMIPPolicySyncClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForMIPPolicySyncClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForMIPPolicySyncClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armm365securityandcompliance.PrivateEndpointConnection{ + Properties: &armm365securityandcompliance.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armm365securityandcompliance.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armm365securityandcompliance.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("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForMIPPolicySyncClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForMIPPolicySyncClient("", 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforsccpowershell_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforsccpowershell_client_test.go new file mode 100644 index 000000000000..690e26a525ac --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionsforsccpowershell_client_test.go @@ -0,0 +1,113 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsForSCCPowershellClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForSCCPowershellClient("", cred, nil) + pager := client.ListByService("", + "", + 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("PrivateEndpointConnection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForSCCPowershellClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForSCCPowershellClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForSCCPowershellClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForSCCPowershellClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armm365securityandcompliance.PrivateEndpointConnection{ + Properties: &armm365securityandcompliance.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armm365securityandcompliance.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armm365securityandcompliance.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("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsForSCCPowershellClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsForSCCPowershellClient("", 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionssec_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionssec_client_test.go new file mode 100644 index 000000000000..3103f92248e5 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privateendpointconnectionssec_client_test.go @@ -0,0 +1,113 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceListPrivateEndpointConnections.json +func ExamplePrivateEndpointConnectionsSecClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsSecClient("", cred, nil) + pager := client.ListByService("", + "", + 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("PrivateEndpointConnection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceGetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsSecClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsSecClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceCreatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsSecClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsSecClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + "", + armm365securityandcompliance.PrivateEndpointConnection{ + Properties: &armm365securityandcompliance.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armm365securityandcompliance.PrivateLinkServiceConnectionState{ + Description: to.StringPtr(""), + Status: armm365securityandcompliance.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("PrivateEndpointConnection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceDeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsSecClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateEndpointConnectionsSecClient("", 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/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresources_client_test.go new file mode 100644 index 000000000000..1ca05299c531 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadPrivateLinkResourcesListByService.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 := armm365securityandcompliance.NewPrivateLinkResourcesClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadPrivateLinkResourceGet.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 := armm365securityandcompliance.NewPrivateLinkResourcesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesadtapi_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesadtapi_client_test.go new file mode 100644 index 000000000000..cee8a8a28b8d --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesadtapi_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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIPrivateLinkResourcesListByService.json +func ExamplePrivateLinkResourcesAdtAPIClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesAdtAPIClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIPrivateLinkResourceGet.json +func ExamplePrivateLinkResourcesAdtAPIClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesAdtAPIClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcescomp_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcescomp_client_test.go new file mode 100644 index 000000000000..b0b84c0329d5 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcescomp_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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterPrivateLinkResourcesListByService.json +func ExamplePrivateLinkResourcesCompClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesCompClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterPrivateLinkResourceGet.json +func ExamplePrivateLinkResourcesCompClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesCompClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesformippolicysync_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesformippolicysync_client_test.go new file mode 100644 index 000000000000..88a0da4fb6c9 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesformippolicysync_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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncPrivateLinkResourcesListByService.json +func ExamplePrivateLinkResourcesForMIPPolicySyncClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesForMIPPolicySyncClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncPrivateLinkResourceGet.json +func ExamplePrivateLinkResourcesForMIPPolicySyncClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesForMIPPolicySyncClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesforsccpowershell_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesforsccpowershell_client_test.go new file mode 100644 index 000000000000..6b59ef837319 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcesforsccpowershell_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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellPrivateLinkResourcesListByService.json +func ExamplePrivateLinkResourcesForSCCPowershellClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesForSCCPowershellClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellPrivateLinkResourceGet.json +func ExamplePrivateLinkResourcesForSCCPowershellClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesForSCCPowershellClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcessec_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcessec_client_test.go new file mode 100644 index 000000000000..4264b58ba378 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkresourcessec_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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterPrivateLinkResourcesListByService.json +func ExamplePrivateLinkResourcesSecClient_ListByService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesSecClient("", cred, nil) + _, err = client.ListByService(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterPrivateLinkResourceGet.json +func ExamplePrivateLinkResourcesSecClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkResourcesSecClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforedmupload_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforedmupload_client_test.go new file mode 100644 index 000000000000..5652737875c0 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforedmupload_client_test.go @@ -0,0 +1,128 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceGet.json +func ExamplePrivateLinkServicesForEDMUploadClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForEDMUploadClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForEDMUploadDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceCreate.json +func ExamplePrivateLinkServicesForEDMUploadClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForEDMUploadClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armm365securityandcompliance.PrivateLinkServicesForEDMUploadDescription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForEDMUploadDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServicePatch.json +func ExamplePrivateLinkServicesForEDMUploadClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForEDMUploadClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armm365securityandcompliance.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("PrivateLinkServicesForEDMUploadDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceList.json +func ExamplePrivateLinkServicesForEDMUploadClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForEDMUploadClient("", 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("PrivateLinkServicesForEDMUploadDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceListByResourceGroup.json +func ExamplePrivateLinkServicesForEDMUploadClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForEDMUploadClient("", 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("PrivateLinkServicesForEDMUploadDescription.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365compliancecenter_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365compliancecenter_client_test.go new file mode 100644 index 000000000000..3136d338d5ec --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365compliancecenter_client_test.go @@ -0,0 +1,149 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceGet.json +func ExamplePrivateLinkServicesForM365ComplianceCenterClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365ComplianceCenterClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForM365ComplianceCenterDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceCreate.json +func ExamplePrivateLinkServicesForM365ComplianceCenterClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365ComplianceCenterClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armm365securityandcompliance.PrivateLinkServicesForM365ComplianceCenterDescription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForM365ComplianceCenterDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServicePatch.json +func ExamplePrivateLinkServicesForM365ComplianceCenterClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365ComplianceCenterClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armm365securityandcompliance.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("PrivateLinkServicesForM365ComplianceCenterDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceDelete.json +func ExamplePrivateLinkServicesForM365ComplianceCenterClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365ComplianceCenterClient("", 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/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceList.json +func ExamplePrivateLinkServicesForM365ComplianceCenterClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365ComplianceCenterClient("", 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("PrivateLinkServicesForM365ComplianceCenterDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ComplianceCenterServiceListByResourceGroup.json +func ExamplePrivateLinkServicesForM365ComplianceCenterClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365ComplianceCenterClient("", 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("PrivateLinkServicesForM365ComplianceCenterDescription.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365securitycenter_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365securitycenter_client_test.go new file mode 100644 index 000000000000..30194c8c4b43 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesform365securitycenter_client_test.go @@ -0,0 +1,149 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceGet.json +func ExamplePrivateLinkServicesForM365SecurityCenterClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365SecurityCenterClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForM365SecurityCenterDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceCreate.json +func ExamplePrivateLinkServicesForM365SecurityCenterClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365SecurityCenterClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armm365securityandcompliance.PrivateLinkServicesForM365SecurityCenterDescription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForM365SecurityCenterDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServicePatch.json +func ExamplePrivateLinkServicesForM365SecurityCenterClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365SecurityCenterClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armm365securityandcompliance.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("PrivateLinkServicesForM365SecurityCenterDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceDelete.json +func ExamplePrivateLinkServicesForM365SecurityCenterClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365SecurityCenterClient("", 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/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceList.json +func ExamplePrivateLinkServicesForM365SecurityCenterClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365SecurityCenterClient("", 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("PrivateLinkServicesForM365SecurityCenterDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SecurityCenterServiceListByResourceGroup.json +func ExamplePrivateLinkServicesForM365SecurityCenterClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForM365SecurityCenterClient("", 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("PrivateLinkServicesForM365SecurityCenterDescription.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesformippolicysync_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesformippolicysync_client_test.go new file mode 100644 index 000000000000..a7279da0aa61 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesformippolicysync_client_test.go @@ -0,0 +1,149 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceGet.json +func ExamplePrivateLinkServicesForMIPPolicySyncClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForMIPPolicySyncClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForMIPPolicySyncDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceCreate.json +func ExamplePrivateLinkServicesForMIPPolicySyncClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForMIPPolicySyncClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armm365securityandcompliance.PrivateLinkServicesForMIPPolicySyncDescription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForMIPPolicySyncDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServicePatch.json +func ExamplePrivateLinkServicesForMIPPolicySyncClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForMIPPolicySyncClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armm365securityandcompliance.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("PrivateLinkServicesForMIPPolicySyncDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceDelete.json +func ExamplePrivateLinkServicesForMIPPolicySyncClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForMIPPolicySyncClient("", 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/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceList.json +func ExamplePrivateLinkServicesForMIPPolicySyncClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForMIPPolicySyncClient("", 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("PrivateLinkServicesForMIPPolicySyncDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/MIPPolicySyncServiceListByResourceGroup.json +func ExamplePrivateLinkServicesForMIPPolicySyncClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForMIPPolicySyncClient("", 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("PrivateLinkServicesForMIPPolicySyncDescription.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforo365managementactivityapi_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforo365managementactivityapi_client_test.go new file mode 100644 index 000000000000..c053e76d86cb --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforo365managementactivityapi_client_test.go @@ -0,0 +1,149 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceGet.json +func ExamplePrivateLinkServicesForO365ManagementActivityAPIClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForO365ManagementActivityAPIClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForO365ManagementActivityAPIDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceCreate.json +func ExamplePrivateLinkServicesForO365ManagementActivityAPIClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForO365ManagementActivityAPIClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armm365securityandcompliance.PrivateLinkServicesForO365ManagementActivityAPIDescription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForO365ManagementActivityAPIDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServicePatch.json +func ExamplePrivateLinkServicesForO365ManagementActivityAPIClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForO365ManagementActivityAPIClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armm365securityandcompliance.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("PrivateLinkServicesForO365ManagementActivityAPIDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceDelete.json +func ExamplePrivateLinkServicesForO365ManagementActivityAPIClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForO365ManagementActivityAPIClient("", 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/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceList.json +func ExamplePrivateLinkServicesForO365ManagementActivityAPIClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForO365ManagementActivityAPIClient("", 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("PrivateLinkServicesForO365ManagementActivityAPIDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/ManagementAPIServiceListByResourceGroup.json +func ExamplePrivateLinkServicesForO365ManagementActivityAPIClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForO365ManagementActivityAPIClient("", 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("PrivateLinkServicesForO365ManagementActivityAPIDescription.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforsccpowershell_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforsccpowershell_client_test.go new file mode 100644 index 000000000000..b39a1d53d8fc --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_privatelinkservicesforsccpowershell_client_test.go @@ -0,0 +1,149 @@ +//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 armm365securityandcompliance_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/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceGet.json +func ExamplePrivateLinkServicesForSCCPowershellClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForSCCPowershellClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForSCCPowershellDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceCreate.json +func ExamplePrivateLinkServicesForSCCPowershellClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForSCCPowershellClient("", cred, nil) + poller, err := client.BeginCreateOrUpdate(ctx, + "", + "", + armm365securityandcompliance.PrivateLinkServicesForSCCPowershellDescription{}, + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("PrivateLinkServicesForSCCPowershellDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServicePatch.json +func ExamplePrivateLinkServicesForSCCPowershellClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForSCCPowershellClient("", cred, nil) + poller, err := client.BeginUpdate(ctx, + "", + "", + armm365securityandcompliance.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("PrivateLinkServicesForSCCPowershellDescription.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceDelete.json +func ExamplePrivateLinkServicesForSCCPowershellClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForSCCPowershellClient("", 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/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceList.json +func ExamplePrivateLinkServicesForSCCPowershellClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForSCCPowershellClient("", 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("PrivateLinkServicesForSCCPowershellDescription.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/SCCPowershellServiceListByResourceGroup.json +func ExamplePrivateLinkServicesForSCCPowershellClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armm365securityandcompliance.NewPrivateLinkServicesForSCCPowershellClient("", 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("PrivateLinkServicesForSCCPowershellDescription.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_services_client_test.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_services_client_test.go new file mode 100644 index 000000000000..abe2250ada54 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/ze_generated_example_services_client_test.go @@ -0,0 +1,40 @@ +//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 armm365securityandcompliance_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance" +) + +// x-ms-original-file: specification/m365securityandcompliance/resource-manager/Microsoft.M365SecurityAndCompliance/preview/2021-03-25-preview/examples/EdmUploadServiceDelete.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 := armm365securityandcompliance.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) + } +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_constants.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_constants.go new file mode 100644 index 000000000000..d01da85a5cc8 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_constants.go @@ -0,0 +1,214 @@ +//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 armm365securityandcompliance + +const ( + module = "armm365securityandcompliance" + version = "v0.1.0" +) + +// 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 +} + +// 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" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" + ProvisioningStateVerifying ProvisioningState = "Verifying" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateDeprovisioned, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + ProvisioningStateVerifying, + } +} + +// 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 +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_models.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_models.go new file mode 100644 index 000000000000..5ff31bb26d81 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_models.go @@ -0,0 +1,1089 @@ +//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 armm365securityandcompliance + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// ErrorDetails - Error details. +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorDetails struct { + raw string + // Object containing 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"` +} + +// Operation - Service REST API operation. +type Operation struct { + // READ-ONLY; The information displayed about the operation. + Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + + // READ-ONLY; Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"` + + // READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} + 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.M365SecurityAndCompliance + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; Resource Type: Services + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationListResult - A list of service operations. It contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of service operations supported by the Microsoft.M365SecurityAndCompliance resource provider. + Value []*Operation `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationResultsDescription - The properties indicating the operation result of an operation on a service. +type OperationResultsDescription struct { + // Additional properties of the operation result. + Properties 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"` + + // READ-ONLY; Required property for system data + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account +type PrivateEndpointConnectionListResult struct { + // Array of private endpoint connections + Value []*PrivateEndpointConnection `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + 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"` +} + +// PrivateEndpointConnectionsAdtAPIBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPI.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsAdtAPIBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsAdtAPIBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPI.BeginDelete method. +type PrivateEndpointConnectionsAdtAPIBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsAdtAPIGetOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPI.Get method. +type PrivateEndpointConnectionsAdtAPIGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsAdtAPIListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPI.ListByService method. +type PrivateEndpointConnectionsAdtAPIListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsCompBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsComp.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsCompBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsCompBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsComp.BeginDelete method. +type PrivateEndpointConnectionsCompBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsCompGetOptions contains the optional parameters for the PrivateEndpointConnectionsComp.Get method. +type PrivateEndpointConnectionsCompGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsCompListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsComp.ListByService method. +type PrivateEndpointConnectionsCompListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForEDMBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsForEDM.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsForEDMBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForEDMBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsForEDM.BeginDelete method. +type PrivateEndpointConnectionsForEDMBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForEDMGetOptions contains the optional parameters for the PrivateEndpointConnectionsForEDM.Get method. +type PrivateEndpointConnectionsForEDMGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForEDMListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsForEDM.ListByService method. +type PrivateEndpointConnectionsForEDMListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForMIPPolicySyncBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsForMIPPolicySync.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsForMIPPolicySyncBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForMIPPolicySyncBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsForMIPPolicySync.BeginDelete +// method. +type PrivateEndpointConnectionsForMIPPolicySyncBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForMIPPolicySyncGetOptions contains the optional parameters for the PrivateEndpointConnectionsForMIPPolicySync.Get method. +type PrivateEndpointConnectionsForMIPPolicySyncGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForMIPPolicySyncListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsForMIPPolicySync.ListByService +// method. +type PrivateEndpointConnectionsForMIPPolicySyncListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForSCCPowershellBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsForSCCPowershell.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsForSCCPowershellBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForSCCPowershellBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsForSCCPowershell.BeginDelete +// method. +type PrivateEndpointConnectionsForSCCPowershellBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForSCCPowershellGetOptions contains the optional parameters for the PrivateEndpointConnectionsForSCCPowershell.Get method. +type PrivateEndpointConnectionsForSCCPowershellGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsForSCCPowershellListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsForSCCPowershell.ListByService +// method. +type PrivateEndpointConnectionsForSCCPowershellListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsSecBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsSec.BeginCreateOrUpdate method. +type PrivateEndpointConnectionsSecBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsSecBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsSec.BeginDelete method. +type PrivateEndpointConnectionsSecBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsSecGetOptions contains the optional parameters for the PrivateEndpointConnectionsSec.Get method. +type PrivateEndpointConnectionsSecGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsSecListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsSec.ListByService method. +type PrivateEndpointConnectionsSecListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + Resource + // Resource properties. + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; Required property for system data + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + 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) +} + +// PrivateLinkResourcesAdtAPIGetOptions contains the optional parameters for the PrivateLinkResourcesAdtAPI.Get method. +type PrivateLinkResourcesAdtAPIGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesAdtAPIListByServiceOptions contains the optional parameters for the PrivateLinkResourcesAdtAPI.ListByService method. +type PrivateLinkResourcesAdtAPIListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesCompGetOptions contains the optional parameters for the PrivateLinkResourcesComp.Get method. +type PrivateLinkResourcesCompGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesCompListByServiceOptions contains the optional parameters for the PrivateLinkResourcesComp.ListByService method. +type PrivateLinkResourcesCompListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesForMIPPolicySyncGetOptions contains the optional parameters for the PrivateLinkResourcesForMIPPolicySync.Get method. +type PrivateLinkResourcesForMIPPolicySyncGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesForMIPPolicySyncListByServiceOptions contains the optional parameters for the PrivateLinkResourcesForMIPPolicySync.ListByService +// method. +type PrivateLinkResourcesForMIPPolicySyncListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesForSCCPowershellGetOptions contains the optional parameters for the PrivateLinkResourcesForSCCPowershell.Get method. +type PrivateLinkResourcesForSCCPowershellGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesForSCCPowershellListByServiceOptions contains the optional parameters for the PrivateLinkResourcesForSCCPowershell.ListByService +// method. +type PrivateLinkResourcesForSCCPowershellListByServiceOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// PrivateLinkResourcesSecGetOptions contains the optional parameters for the PrivateLinkResourcesSec.Get method. +type PrivateLinkResourcesSecGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesSecListByServiceOptions contains the optional parameters for the PrivateLinkResourcesSec.ListByService method. +type PrivateLinkResourcesSecListByServiceOptions 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"` +} + +// PrivateLinkServicesForEDMUploadBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesForEDMUpload.BeginCreateOrUpdate +// method. +type PrivateLinkServicesForEDMUploadBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForEDMUploadBeginUpdateOptions contains the optional parameters for the PrivateLinkServicesForEDMUpload.BeginUpdate method. +type PrivateLinkServicesForEDMUploadBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForEDMUploadDescription - The description of the service. +type PrivateLinkServicesForEDMUploadDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForEDMUploadDescription. +func (p PrivateLinkServicesForEDMUploadDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForEDMUploadDescriptionListResult - A list of service description objects with a next link. +type PrivateLinkServicesForEDMUploadDescriptionListResult struct { + // A list of service description objects. + Value []*PrivateLinkServicesForEDMUploadDescription `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForEDMUploadDescriptionListResult. +func (p PrivateLinkServicesForEDMUploadDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForEDMUploadGetOptions contains the optional parameters for the PrivateLinkServicesForEDMUpload.Get method. +type PrivateLinkServicesForEDMUploadGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForEDMUploadListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesForEDMUpload.ListByResourceGroup +// method. +type PrivateLinkServicesForEDMUploadListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForEDMUploadListOptions contains the optional parameters for the PrivateLinkServicesForEDMUpload.List method. +type PrivateLinkServicesForEDMUploadListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365ComplianceCenterBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesForM365ComplianceCenter.BeginCreateOrUpdate +// method. +type PrivateLinkServicesForM365ComplianceCenterBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365ComplianceCenterBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesForM365ComplianceCenter.BeginDelete +// method. +type PrivateLinkServicesForM365ComplianceCenterBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365ComplianceCenterBeginUpdateOptions contains the optional parameters for the PrivateLinkServicesForM365ComplianceCenter.BeginUpdate +// method. +type PrivateLinkServicesForM365ComplianceCenterBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365ComplianceCenterDescription - The description of the service. +type PrivateLinkServicesForM365ComplianceCenterDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForM365ComplianceCenterDescription. +func (p PrivateLinkServicesForM365ComplianceCenterDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForM365ComplianceCenterDescriptionListResult - A list of service description objects with a next link. +type PrivateLinkServicesForM365ComplianceCenterDescriptionListResult struct { + // A list of service description objects. + Value []*PrivateLinkServicesForM365ComplianceCenterDescription `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForM365ComplianceCenterDescriptionListResult. +func (p PrivateLinkServicesForM365ComplianceCenterDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForM365ComplianceCenterGetOptions contains the optional parameters for the PrivateLinkServicesForM365ComplianceCenter.Get method. +type PrivateLinkServicesForM365ComplianceCenterGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365ComplianceCenterListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesForM365ComplianceCenter.ListByResourceGroup +// method. +type PrivateLinkServicesForM365ComplianceCenterListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365ComplianceCenterListOptions contains the optional parameters for the PrivateLinkServicesForM365ComplianceCenter.List method. +type PrivateLinkServicesForM365ComplianceCenterListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365SecurityCenterBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesForM365SecurityCenter.BeginCreateOrUpdate +// method. +type PrivateLinkServicesForM365SecurityCenterBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365SecurityCenterBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesForM365SecurityCenter.BeginDelete +// method. +type PrivateLinkServicesForM365SecurityCenterBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365SecurityCenterBeginUpdateOptions contains the optional parameters for the PrivateLinkServicesForM365SecurityCenter.BeginUpdate +// method. +type PrivateLinkServicesForM365SecurityCenterBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365SecurityCenterDescription - The description of the service. +type PrivateLinkServicesForM365SecurityCenterDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForM365SecurityCenterDescription. +func (p PrivateLinkServicesForM365SecurityCenterDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForM365SecurityCenterDescriptionListResult - A list of service description objects with a next link. +type PrivateLinkServicesForM365SecurityCenterDescriptionListResult struct { + // A list of service description objects. + Value []*PrivateLinkServicesForM365SecurityCenterDescription `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForM365SecurityCenterDescriptionListResult. +func (p PrivateLinkServicesForM365SecurityCenterDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForM365SecurityCenterGetOptions contains the optional parameters for the PrivateLinkServicesForM365SecurityCenter.Get method. +type PrivateLinkServicesForM365SecurityCenterGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365SecurityCenterListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesForM365SecurityCenter.ListByResourceGroup +// method. +type PrivateLinkServicesForM365SecurityCenterListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForM365SecurityCenterListOptions contains the optional parameters for the PrivateLinkServicesForM365SecurityCenter.List method. +type PrivateLinkServicesForM365SecurityCenterListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForMIPPolicySyncBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesForMIPPolicySync.BeginCreateOrUpdate +// method. +type PrivateLinkServicesForMIPPolicySyncBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForMIPPolicySyncBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesForMIPPolicySync.BeginDelete method. +type PrivateLinkServicesForMIPPolicySyncBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForMIPPolicySyncBeginUpdateOptions contains the optional parameters for the PrivateLinkServicesForMIPPolicySync.BeginUpdate method. +type PrivateLinkServicesForMIPPolicySyncBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForMIPPolicySyncDescription - The description of the service. +type PrivateLinkServicesForMIPPolicySyncDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForMIPPolicySyncDescription. +func (p PrivateLinkServicesForMIPPolicySyncDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForMIPPolicySyncDescriptionListResult - A list of service description objects with a next link. +type PrivateLinkServicesForMIPPolicySyncDescriptionListResult struct { + // A list of service description objects. + Value []*PrivateLinkServicesForMIPPolicySyncDescription `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForMIPPolicySyncDescriptionListResult. +func (p PrivateLinkServicesForMIPPolicySyncDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForMIPPolicySyncGetOptions contains the optional parameters for the PrivateLinkServicesForMIPPolicySync.Get method. +type PrivateLinkServicesForMIPPolicySyncGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForMIPPolicySyncListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesForMIPPolicySync.ListByResourceGroup +// method. +type PrivateLinkServicesForMIPPolicySyncListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForMIPPolicySyncListOptions contains the optional parameters for the PrivateLinkServicesForMIPPolicySync.List method. +type PrivateLinkServicesForMIPPolicySyncListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForO365ManagementActivityAPIBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesForO365ManagementActivityAPI.BeginCreateOrUpdate +// method. +type PrivateLinkServicesForO365ManagementActivityAPIBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForO365ManagementActivityAPIBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesForO365ManagementActivityAPI.BeginDelete +// method. +type PrivateLinkServicesForO365ManagementActivityAPIBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForO365ManagementActivityAPIBeginUpdateOptions contains the optional parameters for the PrivateLinkServicesForO365ManagementActivityAPI.BeginUpdate +// method. +type PrivateLinkServicesForO365ManagementActivityAPIBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForO365ManagementActivityAPIDescription - The description of the service. +type PrivateLinkServicesForO365ManagementActivityAPIDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForO365ManagementActivityAPIDescription. +func (p PrivateLinkServicesForO365ManagementActivityAPIDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult - A list of service description objects with a next link. +type PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult struct { + // A list of service description objects. + Value []*PrivateLinkServicesForO365ManagementActivityAPIDescription `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult. +func (p PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForO365ManagementActivityAPIGetOptions contains the optional parameters for the PrivateLinkServicesForO365ManagementActivityAPI.Get +// method. +type PrivateLinkServicesForO365ManagementActivityAPIGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesForO365ManagementActivityAPI.ListByResourceGroup +// method. +type PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForO365ManagementActivityAPIListOptions contains the optional parameters for the PrivateLinkServicesForO365ManagementActivityAPI.List +// method. +type PrivateLinkServicesForO365ManagementActivityAPIListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForSCCPowershellBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesForSCCPowershell.BeginCreateOrUpdate +// method. +type PrivateLinkServicesForSCCPowershellBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForSCCPowershellBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesForSCCPowershell.BeginDelete method. +type PrivateLinkServicesForSCCPowershellBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForSCCPowershellBeginUpdateOptions contains the optional parameters for the PrivateLinkServicesForSCCPowershell.BeginUpdate method. +type PrivateLinkServicesForSCCPowershellBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForSCCPowershellDescription - The description of the service. +type PrivateLinkServicesForSCCPowershellDescription struct { + ServicesResource + // The common properties of a service. + Properties *ServicesProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForSCCPowershellDescription. +func (p PrivateLinkServicesForSCCPowershellDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ServicesResource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForSCCPowershellDescriptionListResult - A list of service description objects with a next link. +type PrivateLinkServicesForSCCPowershellDescriptionListResult struct { + // A list of service description objects. + Value []*PrivateLinkServicesForSCCPowershellDescription `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of service description objects. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicesForSCCPowershellDescriptionListResult. +func (p PrivateLinkServicesForSCCPowershellDescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkServicesForSCCPowershellGetOptions contains the optional parameters for the PrivateLinkServicesForSCCPowershell.Get method. +type PrivateLinkServicesForSCCPowershellGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForSCCPowershellListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesForSCCPowershell.ListByResourceGroup +// method. +type PrivateLinkServicesForSCCPowershellListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesForSCCPowershellListOptions contains the optional parameters for the PrivateLinkServicesForSCCPowershell.List method. +type PrivateLinkServicesForSCCPowershellListOptions struct { + // placeholder for future optional parameters +} + +// 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"` +} + +// 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"` +} + +// 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 *int64 `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 *int64 `json:"offerThroughput,omitempty"` +} + +// ServiceExportConfigurationInfo - Export operation configuration information +type ServiceExportConfigurationInfo struct { + // The name of the default export storage account. + StorageAccountName *string `json:"storageAccountName,omitempty"` +} + +// ServicesBeginDeleteOptions contains the optional parameters for the Services.BeginDelete method. +type ServicesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// 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 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, "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; Required property for system data + SystemData *SystemData `json:"systemData,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, "systemData", s.SystemData) + 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 +} + +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/m365securityandcompliance/armm365securityandcompliance/zz_generated_operationresults_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_operationresults_client.go new file mode 100644 index 000000000000..0fc6346fea78 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance + +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.M365SecurityAndCompliance/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-03-25-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/m365securityandcompliance/armm365securityandcompliance/zz_generated_operations_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_operations_client.go new file mode 100644 index 000000000000..ad89d0b3113d --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance + +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 M365SecurityAndCompliance REST API operations. +// 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.OperationListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.M365SecurityAndCompliance/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-03-25-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.OperationListResult); 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_pagers.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pagers.go new file mode 100644 index 000000000000..7307139cfd7b --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pagers.go @@ -0,0 +1,1043 @@ +//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 armm365securityandcompliance + +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" +) + +// 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.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.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 +} + +// PrivateEndpointConnectionsAdtAPIListByServicePager provides operations for iterating over paged responses. +type PrivateEndpointConnectionsAdtAPIListByServicePager struct { + client *PrivateEndpointConnectionsAdtAPIClient + current PrivateEndpointConnectionsAdtAPIListByServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointConnectionsAdtAPIListByServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointConnectionsAdtAPIListByServicePager) 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 *PrivateEndpointConnectionsAdtAPIListByServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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.listByServiceHandleError(resp) + return false + } + result, err := p.client.listByServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointConnectionsAdtAPIListByServiceResponse page. +func (p *PrivateEndpointConnectionsAdtAPIListByServicePager) PageResponse() PrivateEndpointConnectionsAdtAPIListByServiceResponse { + return p.current +} + +// PrivateEndpointConnectionsCompListByServicePager provides operations for iterating over paged responses. +type PrivateEndpointConnectionsCompListByServicePager struct { + client *PrivateEndpointConnectionsCompClient + current PrivateEndpointConnectionsCompListByServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointConnectionsCompListByServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointConnectionsCompListByServicePager) 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 *PrivateEndpointConnectionsCompListByServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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.listByServiceHandleError(resp) + return false + } + result, err := p.client.listByServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointConnectionsCompListByServiceResponse page. +func (p *PrivateEndpointConnectionsCompListByServicePager) PageResponse() PrivateEndpointConnectionsCompListByServiceResponse { + return p.current +} + +// PrivateEndpointConnectionsForEDMListByServicePager provides operations for iterating over paged responses. +type PrivateEndpointConnectionsForEDMListByServicePager struct { + client *PrivateEndpointConnectionsForEDMClient + current PrivateEndpointConnectionsForEDMListByServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointConnectionsForEDMListByServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointConnectionsForEDMListByServicePager) 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 *PrivateEndpointConnectionsForEDMListByServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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.listByServiceHandleError(resp) + return false + } + result, err := p.client.listByServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointConnectionsForEDMListByServiceResponse page. +func (p *PrivateEndpointConnectionsForEDMListByServicePager) PageResponse() PrivateEndpointConnectionsForEDMListByServiceResponse { + return p.current +} + +// PrivateEndpointConnectionsForMIPPolicySyncListByServicePager provides operations for iterating over paged responses. +type PrivateEndpointConnectionsForMIPPolicySyncListByServicePager struct { + client *PrivateEndpointConnectionsForMIPPolicySyncClient + current PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointConnectionsForMIPPolicySyncListByServicePager) 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 *PrivateEndpointConnectionsForMIPPolicySyncListByServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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.listByServiceHandleError(resp) + return false + } + result, err := p.client.listByServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse page. +func (p *PrivateEndpointConnectionsForMIPPolicySyncListByServicePager) PageResponse() PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse { + return p.current +} + +// PrivateEndpointConnectionsForSCCPowershellListByServicePager provides operations for iterating over paged responses. +type PrivateEndpointConnectionsForSCCPowershellListByServicePager struct { + client *PrivateEndpointConnectionsForSCCPowershellClient + current PrivateEndpointConnectionsForSCCPowershellListByServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointConnectionsForSCCPowershellListByServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointConnectionsForSCCPowershellListByServicePager) 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 *PrivateEndpointConnectionsForSCCPowershellListByServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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.listByServiceHandleError(resp) + return false + } + result, err := p.client.listByServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointConnectionsForSCCPowershellListByServiceResponse page. +func (p *PrivateEndpointConnectionsForSCCPowershellListByServicePager) PageResponse() PrivateEndpointConnectionsForSCCPowershellListByServiceResponse { + return p.current +} + +// PrivateEndpointConnectionsSecListByServicePager provides operations for iterating over paged responses. +type PrivateEndpointConnectionsSecListByServicePager struct { + client *PrivateEndpointConnectionsSecClient + current PrivateEndpointConnectionsSecListByServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointConnectionsSecListByServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointConnectionsSecListByServicePager) 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 *PrivateEndpointConnectionsSecListByServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.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.listByServiceHandleError(resp) + return false + } + result, err := p.client.listByServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointConnectionsSecListByServiceResponse page. +func (p *PrivateEndpointConnectionsSecListByServicePager) PageResponse() PrivateEndpointConnectionsSecListByServiceResponse { + return p.current +} + +// PrivateLinkServicesForEDMUploadListByResourceGroupPager provides operations for iterating over paged responses. +type PrivateLinkServicesForEDMUploadListByResourceGroupPager struct { + client *PrivateLinkServicesForEDMUploadClient + current PrivateLinkServicesForEDMUploadListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForEDMUploadListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForEDMUploadListByResourceGroupPager) 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 *PrivateLinkServicesForEDMUploadListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForEDMUploadDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForEDMUploadDescriptionListResult.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 PrivateLinkServicesForEDMUploadListByResourceGroupResponse page. +func (p *PrivateLinkServicesForEDMUploadListByResourceGroupPager) PageResponse() PrivateLinkServicesForEDMUploadListByResourceGroupResponse { + return p.current +} + +// PrivateLinkServicesForEDMUploadListPager provides operations for iterating over paged responses. +type PrivateLinkServicesForEDMUploadListPager struct { + client *PrivateLinkServicesForEDMUploadClient + current PrivateLinkServicesForEDMUploadListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForEDMUploadListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForEDMUploadListPager) 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 *PrivateLinkServicesForEDMUploadListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForEDMUploadDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForEDMUploadDescriptionListResult.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 PrivateLinkServicesForEDMUploadListResponse page. +func (p *PrivateLinkServicesForEDMUploadListPager) PageResponse() PrivateLinkServicesForEDMUploadListResponse { + return p.current +} + +// PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager provides operations for iterating over paged responses. +type PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager struct { + client *PrivateLinkServicesForM365ComplianceCenterClient + current PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager) 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 *PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult.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 PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse page. +func (p *PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager) PageResponse() PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse { + return p.current +} + +// PrivateLinkServicesForM365ComplianceCenterListPager provides operations for iterating over paged responses. +type PrivateLinkServicesForM365ComplianceCenterListPager struct { + client *PrivateLinkServicesForM365ComplianceCenterClient + current PrivateLinkServicesForM365ComplianceCenterListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForM365ComplianceCenterListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForM365ComplianceCenterListPager) 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 *PrivateLinkServicesForM365ComplianceCenterListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult.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 PrivateLinkServicesForM365ComplianceCenterListResponse page. +func (p *PrivateLinkServicesForM365ComplianceCenterListPager) PageResponse() PrivateLinkServicesForM365ComplianceCenterListResponse { + return p.current +} + +// PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager provides operations for iterating over paged responses. +type PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager struct { + client *PrivateLinkServicesForM365SecurityCenterClient + current PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager) 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 *PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForM365SecurityCenterDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForM365SecurityCenterDescriptionListResult.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 PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse page. +func (p *PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager) PageResponse() PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse { + return p.current +} + +// PrivateLinkServicesForM365SecurityCenterListPager provides operations for iterating over paged responses. +type PrivateLinkServicesForM365SecurityCenterListPager struct { + client *PrivateLinkServicesForM365SecurityCenterClient + current PrivateLinkServicesForM365SecurityCenterListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForM365SecurityCenterListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForM365SecurityCenterListPager) 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 *PrivateLinkServicesForM365SecurityCenterListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForM365SecurityCenterDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForM365SecurityCenterDescriptionListResult.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 PrivateLinkServicesForM365SecurityCenterListResponse page. +func (p *PrivateLinkServicesForM365SecurityCenterListPager) PageResponse() PrivateLinkServicesForM365SecurityCenterListResponse { + return p.current +} + +// PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager provides operations for iterating over paged responses. +type PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager struct { + client *PrivateLinkServicesForMIPPolicySyncClient + current PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager) 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 *PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForMIPPolicySyncDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForMIPPolicySyncDescriptionListResult.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 PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse page. +func (p *PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager) PageResponse() PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse { + return p.current +} + +// PrivateLinkServicesForMIPPolicySyncListPager provides operations for iterating over paged responses. +type PrivateLinkServicesForMIPPolicySyncListPager struct { + client *PrivateLinkServicesForMIPPolicySyncClient + current PrivateLinkServicesForMIPPolicySyncListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForMIPPolicySyncListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForMIPPolicySyncListPager) 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 *PrivateLinkServicesForMIPPolicySyncListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForMIPPolicySyncDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForMIPPolicySyncDescriptionListResult.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 PrivateLinkServicesForMIPPolicySyncListResponse page. +func (p *PrivateLinkServicesForMIPPolicySyncListPager) PageResponse() PrivateLinkServicesForMIPPolicySyncListResponse { + return p.current +} + +// PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager provides operations for iterating over paged responses. +type PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager struct { + client *PrivateLinkServicesForO365ManagementActivityAPIClient + current PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager) 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 *PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult.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 PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse page. +func (p *PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager) PageResponse() PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse { + return p.current +} + +// PrivateLinkServicesForO365ManagementActivityAPIListPager provides operations for iterating over paged responses. +type PrivateLinkServicesForO365ManagementActivityAPIListPager struct { + client *PrivateLinkServicesForO365ManagementActivityAPIClient + current PrivateLinkServicesForO365ManagementActivityAPIListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForO365ManagementActivityAPIListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForO365ManagementActivityAPIListPager) 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 *PrivateLinkServicesForO365ManagementActivityAPIListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult.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 PrivateLinkServicesForO365ManagementActivityAPIListResponse page. +func (p *PrivateLinkServicesForO365ManagementActivityAPIListPager) PageResponse() PrivateLinkServicesForO365ManagementActivityAPIListResponse { + return p.current +} + +// PrivateLinkServicesForSCCPowershellListByResourceGroupPager provides operations for iterating over paged responses. +type PrivateLinkServicesForSCCPowershellListByResourceGroupPager struct { + client *PrivateLinkServicesForSCCPowershellClient + current PrivateLinkServicesForSCCPowershellListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForSCCPowershellListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForSCCPowershellListByResourceGroupPager) 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 *PrivateLinkServicesForSCCPowershellListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForSCCPowershellDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForSCCPowershellDescriptionListResult.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 PrivateLinkServicesForSCCPowershellListByResourceGroupResponse page. +func (p *PrivateLinkServicesForSCCPowershellListByResourceGroupPager) PageResponse() PrivateLinkServicesForSCCPowershellListByResourceGroupResponse { + return p.current +} + +// PrivateLinkServicesForSCCPowershellListPager provides operations for iterating over paged responses. +type PrivateLinkServicesForSCCPowershellListPager struct { + client *PrivateLinkServicesForSCCPowershellClient + current PrivateLinkServicesForSCCPowershellListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateLinkServicesForSCCPowershellListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateLinkServicesForSCCPowershellListPager) 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 *PrivateLinkServicesForSCCPowershellListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateLinkServicesForSCCPowershellDescriptionListResult.NextLink == nil || len(*p.current.PrivateLinkServicesForSCCPowershellDescriptionListResult.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 PrivateLinkServicesForSCCPowershellListResponse page. +func (p *PrivateLinkServicesForSCCPowershellListPager) PageResponse() PrivateLinkServicesForSCCPowershellListResponse { + return p.current +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pollers.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pollers.go new file mode 100644 index 000000000000..f7324b7197b8 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_pollers.go @@ -0,0 +1,1305 @@ +//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 armm365securityandcompliance + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller) 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 *PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller) 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 PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) + if err != nil { + return PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsAdtAPIDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsAdtAPIDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsAdtAPIDeletePoller) 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 *PrivateEndpointConnectionsAdtAPIDeletePoller) 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 PrivateEndpointConnectionsAdtAPIDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsAdtAPIDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsAdtAPIDeleteResponse, error) { + respType := PrivateEndpointConnectionsAdtAPIDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsAdtAPIDeleteResponse{}, 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 *PrivateEndpointConnectionsAdtAPIDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsCompCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsCompCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsCompCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsCompCreateOrUpdatePoller) 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 PrivateEndpointConnectionsCompCreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsCompCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsCompCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsCompCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) + if err != nil { + return PrivateEndpointConnectionsCompCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsCompCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsCompDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsCompDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsCompDeletePoller) 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 *PrivateEndpointConnectionsCompDeletePoller) 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 PrivateEndpointConnectionsCompDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsCompDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsCompDeleteResponse, error) { + respType := PrivateEndpointConnectionsCompDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsCompDeleteResponse{}, 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 *PrivateEndpointConnectionsCompDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsForEDMCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsForEDMCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsForEDMCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsForEDMCreateOrUpdatePoller) 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 PrivateEndpointConnectionsForEDMCreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsForEDMCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsForEDMCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsForEDMCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) + if err != nil { + return PrivateEndpointConnectionsForEDMCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsForEDMCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsForEDMDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsForEDMDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsForEDMDeletePoller) 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 *PrivateEndpointConnectionsForEDMDeletePoller) 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 PrivateEndpointConnectionsForEDMDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsForEDMDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsForEDMDeleteResponse, error) { + respType := PrivateEndpointConnectionsForEDMDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsForEDMDeleteResponse{}, 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 *PrivateEndpointConnectionsForEDMDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller) 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 PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsForMIPPolicySyncDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsForMIPPolicySyncDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsForMIPPolicySyncDeletePoller) 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 *PrivateEndpointConnectionsForMIPPolicySyncDeletePoller) 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 PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsForMIPPolicySyncDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse, error) { + respType := PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse{}, 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 *PrivateEndpointConnectionsForMIPPolicySyncDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller) 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 PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsForSCCPowershellDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsForSCCPowershellDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsForSCCPowershellDeletePoller) 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 *PrivateEndpointConnectionsForSCCPowershellDeletePoller) 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 PrivateEndpointConnectionsForSCCPowershellDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsForSCCPowershellDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsForSCCPowershellDeleteResponse, error) { + respType := PrivateEndpointConnectionsForSCCPowershellDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellDeleteResponse{}, 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 *PrivateEndpointConnectionsForSCCPowershellDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsSecCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsSecCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsSecCreateOrUpdatePoller) 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 *PrivateEndpointConnectionsSecCreateOrUpdatePoller) 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 PrivateEndpointConnectionsSecCreateOrUpdateResponse will be returned. +func (p *PrivateEndpointConnectionsSecCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsSecCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsSecCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) + if err != nil { + return PrivateEndpointConnectionsSecCreateOrUpdateResponse{}, 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 *PrivateEndpointConnectionsSecCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointConnectionsSecDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointConnectionsSecDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointConnectionsSecDeletePoller) 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 *PrivateEndpointConnectionsSecDeletePoller) 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 PrivateEndpointConnectionsSecDeleteResponse will be returned. +func (p *PrivateEndpointConnectionsSecDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionsSecDeleteResponse, error) { + respType := PrivateEndpointConnectionsSecDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointConnectionsSecDeleteResponse{}, 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 *PrivateEndpointConnectionsSecDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForEDMUploadCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForEDMUploadCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForEDMUploadCreateOrUpdatePoller) 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 *PrivateLinkServicesForEDMUploadCreateOrUpdatePoller) 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 PrivateLinkServicesForEDMUploadCreateOrUpdateResponse will be returned. +func (p *PrivateLinkServicesForEDMUploadCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForEDMUploadCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForEDMUploadCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForEDMUploadDescription) + if err != nil { + return PrivateLinkServicesForEDMUploadCreateOrUpdateResponse{}, 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 *PrivateLinkServicesForEDMUploadCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForEDMUploadUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForEDMUploadUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForEDMUploadUpdatePoller) 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 *PrivateLinkServicesForEDMUploadUpdatePoller) 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 PrivateLinkServicesForEDMUploadUpdateResponse will be returned. +func (p *PrivateLinkServicesForEDMUploadUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForEDMUploadUpdateResponse, error) { + respType := PrivateLinkServicesForEDMUploadUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForEDMUploadDescription) + if err != nil { + return PrivateLinkServicesForEDMUploadUpdateResponse{}, 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 *PrivateLinkServicesForEDMUploadUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller) 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 *PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller) 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 PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse will be returned. +func (p *PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForM365ComplianceCenterDescription) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse{}, 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 *PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForM365ComplianceCenterDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForM365ComplianceCenterDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForM365ComplianceCenterDeletePoller) 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 *PrivateLinkServicesForM365ComplianceCenterDeletePoller) 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 PrivateLinkServicesForM365ComplianceCenterDeleteResponse will be returned. +func (p *PrivateLinkServicesForM365ComplianceCenterDeletePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForM365ComplianceCenterDeleteResponse, error) { + respType := PrivateLinkServicesForM365ComplianceCenterDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterDeleteResponse{}, 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 *PrivateLinkServicesForM365ComplianceCenterDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForM365ComplianceCenterUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForM365ComplianceCenterUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForM365ComplianceCenterUpdatePoller) 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 *PrivateLinkServicesForM365ComplianceCenterUpdatePoller) 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 PrivateLinkServicesForM365ComplianceCenterUpdateResponse will be returned. +func (p *PrivateLinkServicesForM365ComplianceCenterUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForM365ComplianceCenterUpdateResponse, error) { + respType := PrivateLinkServicesForM365ComplianceCenterUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForM365ComplianceCenterDescription) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterUpdateResponse{}, 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 *PrivateLinkServicesForM365ComplianceCenterUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller) 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 *PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller) 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 PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse will be returned. +func (p *PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForM365SecurityCenterDescription) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse{}, 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 *PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForM365SecurityCenterDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForM365SecurityCenterDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForM365SecurityCenterDeletePoller) 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 *PrivateLinkServicesForM365SecurityCenterDeletePoller) 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 PrivateLinkServicesForM365SecurityCenterDeleteResponse will be returned. +func (p *PrivateLinkServicesForM365SecurityCenterDeletePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForM365SecurityCenterDeleteResponse, error) { + respType := PrivateLinkServicesForM365SecurityCenterDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterDeleteResponse{}, 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 *PrivateLinkServicesForM365SecurityCenterDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForM365SecurityCenterUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForM365SecurityCenterUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForM365SecurityCenterUpdatePoller) 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 *PrivateLinkServicesForM365SecurityCenterUpdatePoller) 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 PrivateLinkServicesForM365SecurityCenterUpdateResponse will be returned. +func (p *PrivateLinkServicesForM365SecurityCenterUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForM365SecurityCenterUpdateResponse, error) { + respType := PrivateLinkServicesForM365SecurityCenterUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForM365SecurityCenterDescription) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterUpdateResponse{}, 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 *PrivateLinkServicesForM365SecurityCenterUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller) 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 *PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller) 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 PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse will be returned. +func (p *PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForMIPPolicySyncDescription) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse{}, 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 *PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForMIPPolicySyncDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForMIPPolicySyncDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForMIPPolicySyncDeletePoller) 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 *PrivateLinkServicesForMIPPolicySyncDeletePoller) 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 PrivateLinkServicesForMIPPolicySyncDeleteResponse will be returned. +func (p *PrivateLinkServicesForMIPPolicySyncDeletePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForMIPPolicySyncDeleteResponse, error) { + respType := PrivateLinkServicesForMIPPolicySyncDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncDeleteResponse{}, 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 *PrivateLinkServicesForMIPPolicySyncDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForMIPPolicySyncUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForMIPPolicySyncUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForMIPPolicySyncUpdatePoller) 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 *PrivateLinkServicesForMIPPolicySyncUpdatePoller) 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 PrivateLinkServicesForMIPPolicySyncUpdateResponse will be returned. +func (p *PrivateLinkServicesForMIPPolicySyncUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForMIPPolicySyncUpdateResponse, error) { + respType := PrivateLinkServicesForMIPPolicySyncUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForMIPPolicySyncDescription) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncUpdateResponse{}, 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 *PrivateLinkServicesForMIPPolicySyncUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller) 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 *PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller) 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 PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse will be returned. +func (p *PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForO365ManagementActivityAPIDescription) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse{}, 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 *PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForO365ManagementActivityAPIDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForO365ManagementActivityAPIDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForO365ManagementActivityAPIDeletePoller) 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 *PrivateLinkServicesForO365ManagementActivityAPIDeletePoller) 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 PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse will be returned. +func (p *PrivateLinkServicesForO365ManagementActivityAPIDeletePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse, error) { + respType := PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse{}, 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 *PrivateLinkServicesForO365ManagementActivityAPIDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller) 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 *PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller) 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 PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse will be returned. +func (p *PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse, error) { + respType := PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForO365ManagementActivityAPIDescription) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse{}, 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 *PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller) 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 *PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller) 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 PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse will be returned. +func (p *PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForSCCPowershellDescription) + if err != nil { + return PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse{}, 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 *PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForSCCPowershellDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForSCCPowershellDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForSCCPowershellDeletePoller) 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 *PrivateLinkServicesForSCCPowershellDeletePoller) 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 PrivateLinkServicesForSCCPowershellDeleteResponse will be returned. +func (p *PrivateLinkServicesForSCCPowershellDeletePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForSCCPowershellDeleteResponse, error) { + respType := PrivateLinkServicesForSCCPowershellDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateLinkServicesForSCCPowershellDeleteResponse{}, 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 *PrivateLinkServicesForSCCPowershellDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateLinkServicesForSCCPowershellUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PrivateLinkServicesForSCCPowershellUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateLinkServicesForSCCPowershellUpdatePoller) 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 *PrivateLinkServicesForSCCPowershellUpdatePoller) 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 PrivateLinkServicesForSCCPowershellUpdateResponse will be returned. +func (p *PrivateLinkServicesForSCCPowershellUpdatePoller) FinalResponse(ctx context.Context) (PrivateLinkServicesForSCCPowershellUpdateResponse, error) { + respType := PrivateLinkServicesForSCCPowershellUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateLinkServicesForSCCPowershellDescription) + if err != nil { + return PrivateLinkServicesForSCCPowershellUpdateResponse{}, 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 *PrivateLinkServicesForSCCPowershellUpdatePoller) 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() +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsadtapi_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsadtapi_client.go new file mode 100644 index 000000000000..ab099f275db7 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsadtapi_client.go @@ -0,0 +1,334 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateEndpointConnectionsAdtAPIClient contains the methods for the PrivateEndpointConnectionsAdtAPI group. +// Don't use this type directly, use NewPrivateEndpointConnectionsAdtAPIClient() instead. +type PrivateEndpointConnectionsAdtAPIClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsAdtAPIClient creates a new instance of PrivateEndpointConnectionsAdtAPIClient with the specified values. +func NewPrivateEndpointConnectionsAdtAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsAdtAPIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsAdtAPIClient{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 *PrivateEndpointConnectionsAdtAPIClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsAdtAPIBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsAdtAPIClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller{ + 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 *PrivateEndpointConnectionsAdtAPIClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsAdtAPIBeginCreateOrUpdateOptions) (*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, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsAdtAPIClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsAdtAPIBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-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 *PrivateEndpointConnectionsAdtAPIClient) 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 *PrivateEndpointConnectionsAdtAPIClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIBeginDeleteOptions) (PrivateEndpointConnectionsAdtAPIDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsAdtAPIDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsAdtAPIDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsAdtAPIClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsAdtAPIDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsAdtAPIDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsAdtAPIClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIBeginDeleteOptions) (*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 *PrivateEndpointConnectionsAdtAPIClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-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 *PrivateEndpointConnectionsAdtAPIClient) 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 *PrivateEndpointConnectionsAdtAPIClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIGetOptions) (PrivateEndpointConnectionsAdtAPIGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsAdtAPIGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsAdtAPIGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsAdtAPIGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsAdtAPIClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsAdtAPIClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsAdtAPIGetResponse, error) { + result := PrivateEndpointConnectionsAdtAPIGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsAdtAPIGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsAdtAPIClient) 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 *PrivateEndpointConnectionsAdtAPIClient) ListByService(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsAdtAPIListByServiceOptions) *PrivateEndpointConnectionsAdtAPIListByServicePager { + return &PrivateEndpointConnectionsAdtAPIListByServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointConnectionsAdtAPIListByServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + }, + } +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsAdtAPIClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsAdtAPIListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsAdtAPIClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsAdtAPIListByServiceResponse, error) { + result := PrivateEndpointConnectionsAdtAPIListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsAdtAPIListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsAdtAPIClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionscomp_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionscomp_client.go new file mode 100644 index 000000000000..e3e43563974e --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionscomp_client.go @@ -0,0 +1,334 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateEndpointConnectionsCompClient contains the methods for the PrivateEndpointConnectionsComp group. +// Don't use this type directly, use NewPrivateEndpointConnectionsCompClient() instead. +type PrivateEndpointConnectionsCompClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsCompClient creates a new instance of PrivateEndpointConnectionsCompClient with the specified values. +func NewPrivateEndpointConnectionsCompClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsCompClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsCompClient{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 *PrivateEndpointConnectionsCompClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsCompBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsCompClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsCompCreateOrUpdatePoller{ + 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 *PrivateEndpointConnectionsCompClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsCompBeginCreateOrUpdateOptions) (*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, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsCompClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsCompBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-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 *PrivateEndpointConnectionsCompClient) 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 *PrivateEndpointConnectionsCompClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsCompBeginDeleteOptions) (PrivateEndpointConnectionsCompDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsCompDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsCompDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsCompClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsCompDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsCompDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsCompClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsCompBeginDeleteOptions) (*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 *PrivateEndpointConnectionsCompClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsCompBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-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 *PrivateEndpointConnectionsCompClient) 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 *PrivateEndpointConnectionsCompClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsCompGetOptions) (PrivateEndpointConnectionsCompGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsCompGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsCompGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsCompGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsCompClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsCompGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsCompClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsCompGetResponse, error) { + result := PrivateEndpointConnectionsCompGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsCompGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsCompClient) 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 *PrivateEndpointConnectionsCompClient) ListByService(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsCompListByServiceOptions) *PrivateEndpointConnectionsCompListByServicePager { + return &PrivateEndpointConnectionsCompListByServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointConnectionsCompListByServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + }, + } +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsCompClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsCompListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsCompClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsCompListByServiceResponse, error) { + result := PrivateEndpointConnectionsCompListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsCompListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsCompClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforedm_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforedm_client.go new file mode 100644 index 000000000000..d3593186f783 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforedm_client.go @@ -0,0 +1,334 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateEndpointConnectionsForEDMClient contains the methods for the PrivateEndpointConnectionsForEDM group. +// Don't use this type directly, use NewPrivateEndpointConnectionsForEDMClient() instead. +type PrivateEndpointConnectionsForEDMClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsForEDMClient creates a new instance of PrivateEndpointConnectionsForEDMClient with the specified values. +func NewPrivateEndpointConnectionsForEDMClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsForEDMClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsForEDMClient{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 *PrivateEndpointConnectionsForEDMClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForEDMBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsForEDMClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsForEDMCreateOrUpdatePoller{ + 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 *PrivateEndpointConnectionsForEDMClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForEDMBeginCreateOrUpdateOptions) (*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, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsForEDMClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForEDMBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-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 *PrivateEndpointConnectionsForEDMClient) 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 *PrivateEndpointConnectionsForEDMClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForEDMBeginDeleteOptions) (PrivateEndpointConnectionsForEDMDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsForEDMDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsForEDMDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsForEDMClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsForEDMDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsForEDMDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsForEDMClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForEDMBeginDeleteOptions) (*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 *PrivateEndpointConnectionsForEDMClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForEDMBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-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 *PrivateEndpointConnectionsForEDMClient) 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 *PrivateEndpointConnectionsForEDMClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForEDMGetOptions) (PrivateEndpointConnectionsForEDMGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsForEDMGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsForEDMGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsForEDMGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsForEDMClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForEDMGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsForEDMClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsForEDMGetResponse, error) { + result := PrivateEndpointConnectionsForEDMGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsForEDMGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsForEDMClient) 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 *PrivateEndpointConnectionsForEDMClient) ListByService(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsForEDMListByServiceOptions) *PrivateEndpointConnectionsForEDMListByServicePager { + return &PrivateEndpointConnectionsForEDMListByServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointConnectionsForEDMListByServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + }, + } +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsForEDMClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsForEDMListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsForEDMClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsForEDMListByServiceResponse, error) { + result := PrivateEndpointConnectionsForEDMListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsForEDMListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsForEDMClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsformippolicysync_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsformippolicysync_client.go new file mode 100644 index 000000000000..37eea6305d97 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsformippolicysync_client.go @@ -0,0 +1,334 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateEndpointConnectionsForMIPPolicySyncClient contains the methods for the PrivateEndpointConnectionsForMIPPolicySync group. +// Don't use this type directly, use NewPrivateEndpointConnectionsForMIPPolicySyncClient() instead. +type PrivateEndpointConnectionsForMIPPolicySyncClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsForMIPPolicySyncClient creates a new instance of PrivateEndpointConnectionsForMIPPolicySyncClient with the specified values. +func NewPrivateEndpointConnectionsForMIPPolicySyncClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsForMIPPolicySyncClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsForMIPPolicySyncClient{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 *PrivateEndpointConnectionsForMIPPolicySyncClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForMIPPolicySyncBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsForMIPPolicySyncClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller{ + 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 *PrivateEndpointConnectionsForMIPPolicySyncClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForMIPPolicySyncBeginCreateOrUpdateOptions) (*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, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForMIPPolicySyncBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-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 *PrivateEndpointConnectionsForMIPPolicySyncClient) 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 *PrivateEndpointConnectionsForMIPPolicySyncClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForMIPPolicySyncBeginDeleteOptions) (PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsForMIPPolicySyncClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsForMIPPolicySyncDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForMIPPolicySyncBeginDeleteOptions) (*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 *PrivateEndpointConnectionsForMIPPolicySyncClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForMIPPolicySyncBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-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 *PrivateEndpointConnectionsForMIPPolicySyncClient) 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 *PrivateEndpointConnectionsForMIPPolicySyncClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForMIPPolicySyncGetOptions) (PrivateEndpointConnectionsForMIPPolicySyncGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsForMIPPolicySyncGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForMIPPolicySyncGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsForMIPPolicySyncGetResponse, error) { + result := PrivateEndpointConnectionsForMIPPolicySyncGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) 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 *PrivateEndpointConnectionsForMIPPolicySyncClient) ListByService(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsForMIPPolicySyncListByServiceOptions) *PrivateEndpointConnectionsForMIPPolicySyncListByServicePager { + return &PrivateEndpointConnectionsForMIPPolicySyncListByServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + }, + } +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsForMIPPolicySyncListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse, error) { + result := PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsForMIPPolicySyncClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforsccpowershell_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforsccpowershell_client.go new file mode 100644 index 000000000000..12b9ac118a0a --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsforsccpowershell_client.go @@ -0,0 +1,334 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateEndpointConnectionsForSCCPowershellClient contains the methods for the PrivateEndpointConnectionsForSCCPowershell group. +// Don't use this type directly, use NewPrivateEndpointConnectionsForSCCPowershellClient() instead. +type PrivateEndpointConnectionsForSCCPowershellClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsForSCCPowershellClient creates a new instance of PrivateEndpointConnectionsForSCCPowershellClient with the specified values. +func NewPrivateEndpointConnectionsForSCCPowershellClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsForSCCPowershellClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsForSCCPowershellClient{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 *PrivateEndpointConnectionsForSCCPowershellClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForSCCPowershellBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsForSCCPowershellClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller{ + 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 *PrivateEndpointConnectionsForSCCPowershellClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForSCCPowershellBeginCreateOrUpdateOptions) (*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, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsForSCCPowershellBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-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 *PrivateEndpointConnectionsForSCCPowershellClient) 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 *PrivateEndpointConnectionsForSCCPowershellClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForSCCPowershellBeginDeleteOptions) (PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsForSCCPowershellClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsForSCCPowershellDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForSCCPowershellBeginDeleteOptions) (*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 *PrivateEndpointConnectionsForSCCPowershellClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForSCCPowershellBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-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 *PrivateEndpointConnectionsForSCCPowershellClient) 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 *PrivateEndpointConnectionsForSCCPowershellClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForSCCPowershellGetOptions) (PrivateEndpointConnectionsForSCCPowershellGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsForSCCPowershellGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsForSCCPowershellGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsForSCCPowershellGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsForSCCPowershellGetResponse, error) { + result := PrivateEndpointConnectionsForSCCPowershellGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsForSCCPowershellGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) 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 *PrivateEndpointConnectionsForSCCPowershellClient) ListByService(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsForSCCPowershellListByServiceOptions) *PrivateEndpointConnectionsForSCCPowershellListByServicePager { + return &PrivateEndpointConnectionsForSCCPowershellListByServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointConnectionsForSCCPowershellListByServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + }, + } +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsForSCCPowershellListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsForSCCPowershellListByServiceResponse, error) { + result := PrivateEndpointConnectionsForSCCPowershellListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsForSCCPowershellListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsForSCCPowershellClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionssec_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionssec_client.go new file mode 100644 index 000000000000..87b3d280d1ae --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionssec_client.go @@ -0,0 +1,334 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateEndpointConnectionsSecClient contains the methods for the PrivateEndpointConnectionsSec group. +// Don't use this type directly, use NewPrivateEndpointConnectionsSecClient() instead. +type PrivateEndpointConnectionsSecClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsSecClient creates a new instance of PrivateEndpointConnectionsSecClient with the specified values. +func NewPrivateEndpointConnectionsSecClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsSecClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsSecClient{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 *PrivateEndpointConnectionsSecClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsSecBeginCreateOrUpdateOptions) (PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options) + if err != nil { + return PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse{}, err + } + result := PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsSecClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsSecCreateOrUpdatePoller{ + 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 *PrivateEndpointConnectionsSecClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsSecBeginCreateOrUpdateOptions) (*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, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsSecClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsSecBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-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 *PrivateEndpointConnectionsSecClient) 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 *PrivateEndpointConnectionsSecClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsSecBeginDeleteOptions) (PrivateEndpointConnectionsSecDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsSecDeletePollerResponse{}, err + } + result := PrivateEndpointConnectionsSecDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointConnectionsSecClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointConnectionsSecDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointConnectionsSecDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a private endpoint connection. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateEndpointConnectionsSecClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsSecBeginDeleteOptions) (*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 *PrivateEndpointConnectionsSecClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsSecBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-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 *PrivateEndpointConnectionsSecClient) 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 *PrivateEndpointConnectionsSecClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsSecGetOptions) (PrivateEndpointConnectionsSecGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsSecGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsSecGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsSecGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsSecClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsSecGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsSecClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsSecGetResponse, error) { + result := PrivateEndpointConnectionsSecGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsSecGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsSecClient) 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 *PrivateEndpointConnectionsSecClient) ListByService(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsSecListByServiceOptions) *PrivateEndpointConnectionsSecListByServicePager { + return &PrivateEndpointConnectionsSecListByServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointConnectionsSecListByServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + }, + } +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateEndpointConnectionsSecClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsSecListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateEndpointConnectionsSecClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsSecListByServiceResponse, error) { + result := PrivateEndpointConnectionsSecListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsSecListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateEndpointConnectionsSecClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresources_client.go new file mode 100644 index 000000000000..62ee876abcad --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance + +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.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-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.PrivateLinkResource); 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.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-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.PrivateLinkResourceListResult); 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesadtapi_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesadtapi_client.go new file mode 100644 index 000000000000..dfe259a1401b --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesadtapi_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 armm365securityandcompliance + +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" +) + +// PrivateLinkResourcesAdtAPIClient contains the methods for the PrivateLinkResourcesAdtAPI group. +// Don't use this type directly, use NewPrivateLinkResourcesAdtAPIClient() instead. +type PrivateLinkResourcesAdtAPIClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesAdtAPIClient creates a new instance of PrivateLinkResourcesAdtAPIClient with the specified values. +func NewPrivateLinkResourcesAdtAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesAdtAPIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesAdtAPIClient{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 *PrivateLinkResourcesAdtAPIClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesAdtAPIGetOptions) (PrivateLinkResourcesAdtAPIGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupName, options) + if err != nil { + return PrivateLinkResourcesAdtAPIGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesAdtAPIGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesAdtAPIGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesAdtAPIClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesAdtAPIGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesAdtAPIClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesAdtAPIGetResponse, error) { + result := PrivateLinkResourcesAdtAPIGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesAdtAPIGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesAdtAPIClient) 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 *PrivateLinkResourcesAdtAPIClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesAdtAPIListByServiceOptions) (PrivateLinkResourcesAdtAPIListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesAdtAPIListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesAdtAPIListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesAdtAPIListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateLinkResourcesAdtAPIClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesAdtAPIListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateLinkResourcesAdtAPIClient) listByServiceHandleResponse(resp *http.Response) (PrivateLinkResourcesAdtAPIListByServiceResponse, error) { + result := PrivateLinkResourcesAdtAPIListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesAdtAPIListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateLinkResourcesAdtAPIClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcescomp_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcescomp_client.go new file mode 100644 index 000000000000..bcfdb26ea98f --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcescomp_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 armm365securityandcompliance + +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" +) + +// PrivateLinkResourcesCompClient contains the methods for the PrivateLinkResourcesComp group. +// Don't use this type directly, use NewPrivateLinkResourcesCompClient() instead. +type PrivateLinkResourcesCompClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesCompClient creates a new instance of PrivateLinkResourcesCompClient with the specified values. +func NewPrivateLinkResourcesCompClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesCompClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesCompClient{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 *PrivateLinkResourcesCompClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesCompGetOptions) (PrivateLinkResourcesCompGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupName, options) + if err != nil { + return PrivateLinkResourcesCompGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesCompGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesCompGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesCompClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesCompGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesCompClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesCompGetResponse, error) { + result := PrivateLinkResourcesCompGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesCompGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesCompClient) 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 *PrivateLinkResourcesCompClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesCompListByServiceOptions) (PrivateLinkResourcesCompListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesCompListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesCompListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesCompListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateLinkResourcesCompClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesCompListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateLinkResourcesCompClient) listByServiceHandleResponse(resp *http.Response) (PrivateLinkResourcesCompListByServiceResponse, error) { + result := PrivateLinkResourcesCompListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesCompListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateLinkResourcesCompClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesformippolicysync_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesformippolicysync_client.go new file mode 100644 index 000000000000..8e1afd500634 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesformippolicysync_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 armm365securityandcompliance + +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" +) + +// PrivateLinkResourcesForMIPPolicySyncClient contains the methods for the PrivateLinkResourcesForMIPPolicySync group. +// Don't use this type directly, use NewPrivateLinkResourcesForMIPPolicySyncClient() instead. +type PrivateLinkResourcesForMIPPolicySyncClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesForMIPPolicySyncClient creates a new instance of PrivateLinkResourcesForMIPPolicySyncClient with the specified values. +func NewPrivateLinkResourcesForMIPPolicySyncClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesForMIPPolicySyncClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesForMIPPolicySyncClient{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 *PrivateLinkResourcesForMIPPolicySyncClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesForMIPPolicySyncGetOptions) (PrivateLinkResourcesForMIPPolicySyncGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupName, options) + if err != nil { + return PrivateLinkResourcesForMIPPolicySyncGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesForMIPPolicySyncGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesForMIPPolicySyncGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesForMIPPolicySyncClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesForMIPPolicySyncGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesForMIPPolicySyncClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesForMIPPolicySyncGetResponse, error) { + result := PrivateLinkResourcesForMIPPolicySyncGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesForMIPPolicySyncGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesForMIPPolicySyncClient) 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 *PrivateLinkResourcesForMIPPolicySyncClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesForMIPPolicySyncListByServiceOptions) (PrivateLinkResourcesForMIPPolicySyncListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesForMIPPolicySyncListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesForMIPPolicySyncListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesForMIPPolicySyncListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateLinkResourcesForMIPPolicySyncClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesForMIPPolicySyncListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateLinkResourcesForMIPPolicySyncClient) listByServiceHandleResponse(resp *http.Response) (PrivateLinkResourcesForMIPPolicySyncListByServiceResponse, error) { + result := PrivateLinkResourcesForMIPPolicySyncListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesForMIPPolicySyncListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateLinkResourcesForMIPPolicySyncClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesforsccpowershell_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesforsccpowershell_client.go new file mode 100644 index 000000000000..f5c61f232ecc --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcesforsccpowershell_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 armm365securityandcompliance + +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" +) + +// PrivateLinkResourcesForSCCPowershellClient contains the methods for the PrivateLinkResourcesForSCCPowershell group. +// Don't use this type directly, use NewPrivateLinkResourcesForSCCPowershellClient() instead. +type PrivateLinkResourcesForSCCPowershellClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesForSCCPowershellClient creates a new instance of PrivateLinkResourcesForSCCPowershellClient with the specified values. +func NewPrivateLinkResourcesForSCCPowershellClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesForSCCPowershellClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesForSCCPowershellClient{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 *PrivateLinkResourcesForSCCPowershellClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesForSCCPowershellGetOptions) (PrivateLinkResourcesForSCCPowershellGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupName, options) + if err != nil { + return PrivateLinkResourcesForSCCPowershellGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesForSCCPowershellGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesForSCCPowershellGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesForSCCPowershellClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesForSCCPowershellGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesForSCCPowershellClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesForSCCPowershellGetResponse, error) { + result := PrivateLinkResourcesForSCCPowershellGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesForSCCPowershellGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesForSCCPowershellClient) 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 *PrivateLinkResourcesForSCCPowershellClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesForSCCPowershellListByServiceOptions) (PrivateLinkResourcesForSCCPowershellListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesForSCCPowershellListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesForSCCPowershellListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesForSCCPowershellListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateLinkResourcesForSCCPowershellClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesForSCCPowershellListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateLinkResourcesForSCCPowershellClient) listByServiceHandleResponse(resp *http.Response) (PrivateLinkResourcesForSCCPowershellListByServiceResponse, error) { + result := PrivateLinkResourcesForSCCPowershellListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesForSCCPowershellListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateLinkResourcesForSCCPowershellClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcessec_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcessec_client.go new file mode 100644 index 000000000000..31237305ccaf --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkresourcessec_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 armm365securityandcompliance + +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" +) + +// PrivateLinkResourcesSecClient contains the methods for the PrivateLinkResourcesSec group. +// Don't use this type directly, use NewPrivateLinkResourcesSecClient() instead. +type PrivateLinkResourcesSecClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesSecClient creates a new instance of PrivateLinkResourcesSecClient with the specified values. +func NewPrivateLinkResourcesSecClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesSecClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesSecClient{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 *PrivateLinkResourcesSecClient) Get(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesSecGetOptions) (PrivateLinkResourcesSecGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, groupName, options) + if err != nil { + return PrivateLinkResourcesSecGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesSecGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesSecGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesSecClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, groupName string, options *PrivateLinkResourcesSecGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesSecClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesSecGetResponse, error) { + result := PrivateLinkResourcesSecGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesSecGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesSecClient) 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 *PrivateLinkResourcesSecClient) ListByService(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesSecListByServiceOptions) (PrivateLinkResourcesSecListByServiceResponse, error) { + req, err := client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkResourcesSecListByServiceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesSecListByServiceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesSecListByServiceResponse{}, client.listByServiceHandleError(resp) + } + return client.listByServiceHandleResponse(resp) +} + +// listByServiceCreateRequest creates the ListByService request. +func (client *PrivateLinkResourcesSecClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesSecListByServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByServiceHandleResponse handles the ListByService response. +func (client *PrivateLinkResourcesSecClient) listByServiceHandleResponse(resp *http.Response) (PrivateLinkResourcesSecListByServiceResponse, error) { + result := PrivateLinkResourcesSecListByServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesSecListByServiceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByServiceHandleError handles the ListByService error response. +func (client *PrivateLinkResourcesSecClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforedmupload_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforedmupload_client.go new file mode 100644 index 000000000000..d4dfc50297c5 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforedmupload_client.go @@ -0,0 +1,372 @@ +//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 armm365securityandcompliance + +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" +) + +// PrivateLinkServicesForEDMUploadClient contains the methods for the PrivateLinkServicesForEDMUpload group. +// Don't use this type directly, use NewPrivateLinkServicesForEDMUploadClient() instead. +type PrivateLinkServicesForEDMUploadClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkServicesForEDMUploadClient creates a new instance of PrivateLinkServicesForEDMUploadClient with the specified values. +func NewPrivateLinkServicesForEDMUploadClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesForEDMUploadClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesForEDMUploadClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the metadata of a privateLinkServicesForEDMUpload instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForEDMUploadClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForEDMUploadDescription PrivateLinkServicesForEDMUploadDescription, options *PrivateLinkServicesForEDMUploadBeginCreateOrUpdateOptions) (PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateLinkServicesForEDMUploadDescription, options) + if err != nil { + return PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForEDMUploadClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForEDMUploadCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a privateLinkServicesForEDMUpload instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForEDMUploadClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForEDMUploadDescription PrivateLinkServicesForEDMUploadDescription, options *PrivateLinkServicesForEDMUploadBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateLinkServicesForEDMUploadDescription, 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 *PrivateLinkServicesForEDMUploadClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForEDMUploadDescription PrivateLinkServicesForEDMUploadDescription, options *PrivateLinkServicesForEDMUploadBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateLinkServicesForEDMUploadDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateLinkServicesForEDMUploadClient) 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) +} + +// Get - Get the metadata of a privateLinkServicesForEDMUpload resource. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForEDMUploadClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForEDMUploadGetOptions) (PrivateLinkServicesForEDMUploadGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForEDMUploadGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesForEDMUploadGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesForEDMUploadGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesForEDMUploadClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForEDMUploadGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesForEDMUploadClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesForEDMUploadGetResponse, error) { + result := PrivateLinkServicesForEDMUploadGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForEDMUploadDescription); err != nil { + return PrivateLinkServicesForEDMUploadGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkServicesForEDMUploadClient) 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 privateLinkServicesForEDMUpload instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForEDMUploadClient) List(options *PrivateLinkServicesForEDMUploadListOptions) *PrivateLinkServicesForEDMUploadListPager { + return &PrivateLinkServicesForEDMUploadListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForEDMUploadListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForEDMUploadDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesForEDMUploadClient) listCreateRequest(ctx context.Context, options *PrivateLinkServicesForEDMUploadListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesForEDMUploadClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesForEDMUploadListResponse, error) { + result := PrivateLinkServicesForEDMUploadListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForEDMUploadDescriptionListResult); err != nil { + return PrivateLinkServicesForEDMUploadListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkServicesForEDMUploadClient) 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 *PrivateLinkServicesForEDMUploadClient) ListByResourceGroup(resourceGroupName string, options *PrivateLinkServicesForEDMUploadListByResourceGroupOptions) *PrivateLinkServicesForEDMUploadListByResourceGroupPager { + return &PrivateLinkServicesForEDMUploadListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForEDMUploadListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForEDMUploadDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateLinkServicesForEDMUploadClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForEDMUploadListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateLinkServicesForEDMUploadClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesForEDMUploadListByResourceGroupResponse, error) { + result := PrivateLinkServicesForEDMUploadListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForEDMUploadDescriptionListResult); err != nil { + return PrivateLinkServicesForEDMUploadListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *PrivateLinkServicesForEDMUploadClient) 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 privateLinkServicesForEDMUpload instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForEDMUploadClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForEDMUploadBeginUpdateOptions) (PrivateLinkServicesForEDMUploadUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return PrivateLinkServicesForEDMUploadUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForEDMUploadUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForEDMUploadClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PrivateLinkServicesForEDMUploadUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForEDMUploadUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a privateLinkServicesForEDMUpload instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForEDMUploadClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForEDMUploadBeginUpdateOptions) (*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, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinkServicesForEDMUploadClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForEDMUploadBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-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 *PrivateLinkServicesForEDMUploadClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365compliancecenter_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365compliancecenter_client.go new file mode 100644 index 000000000000..3115dd54c7ae --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365compliancecenter_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 armm365securityandcompliance + +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" +) + +// PrivateLinkServicesForM365ComplianceCenterClient contains the methods for the PrivateLinkServicesForM365ComplianceCenter group. +// Don't use this type directly, use NewPrivateLinkServicesForM365ComplianceCenterClient() instead. +type PrivateLinkServicesForM365ComplianceCenterClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkServicesForM365ComplianceCenterClient creates a new instance of PrivateLinkServicesForM365ComplianceCenterClient with the specified values. +func NewPrivateLinkServicesForM365ComplianceCenterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesForM365ComplianceCenterClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesForM365ComplianceCenterClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the metadata of a privateLinkServicesForM365ComplianceCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForM365ComplianceCenterDescription PrivateLinkServicesForM365ComplianceCenterDescription, options *PrivateLinkServicesForM365ComplianceCenterBeginCreateOrUpdateOptions) (PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateLinkServicesForM365ComplianceCenterDescription, options) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForM365ComplianceCenterClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a privateLinkServicesForM365ComplianceCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForM365ComplianceCenterDescription PrivateLinkServicesForM365ComplianceCenterDescription, options *PrivateLinkServicesForM365ComplianceCenterBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateLinkServicesForM365ComplianceCenterDescription, 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 *PrivateLinkServicesForM365ComplianceCenterClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForM365ComplianceCenterDescription PrivateLinkServicesForM365ComplianceCenterDescription, options *PrivateLinkServicesForM365ComplianceCenterBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateLinkServicesForM365ComplianceCenterDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) 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 *PrivateLinkServicesForM365ComplianceCenterClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365ComplianceCenterBeginDeleteOptions) (PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse{}, err + } + result := PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForM365ComplianceCenterClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForM365ComplianceCenterDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365ComplianceCenterBeginDeleteOptions) (*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.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365ComplianceCenterBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-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 *PrivateLinkServicesForM365ComplianceCenterClient) 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 privateLinkServicesForM365ComplianceCenter resource. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365ComplianceCenterGetOptions) (PrivateLinkServicesForM365ComplianceCenterGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesForM365ComplianceCenterGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365ComplianceCenterGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesForM365ComplianceCenterGetResponse, error) { + result := PrivateLinkServicesForM365ComplianceCenterGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForM365ComplianceCenterDescription); err != nil { + return PrivateLinkServicesForM365ComplianceCenterGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) 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 privateLinkServicesForM365ComplianceCenter instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) List(options *PrivateLinkServicesForM365ComplianceCenterListOptions) *PrivateLinkServicesForM365ComplianceCenterListPager { + return &PrivateLinkServicesForM365ComplianceCenterListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForM365ComplianceCenterListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) listCreateRequest(ctx context.Context, options *PrivateLinkServicesForM365ComplianceCenterListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesForM365ComplianceCenterListResponse, error) { + result := PrivateLinkServicesForM365ComplianceCenterListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult); err != nil { + return PrivateLinkServicesForM365ComplianceCenterListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) 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 *PrivateLinkServicesForM365ComplianceCenterClient) ListByResourceGroup(resourceGroupName string, options *PrivateLinkServicesForM365ComplianceCenterListByResourceGroupOptions) *PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager { + return &PrivateLinkServicesForM365ComplianceCenterListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForM365ComplianceCenterListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse, error) { + result := PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForM365ComplianceCenterDescriptionListResult); err != nil { + return PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) 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 privateLinkServicesForM365ComplianceCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForM365ComplianceCenterBeginUpdateOptions) (PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForM365ComplianceCenterClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForM365ComplianceCenterUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a privateLinkServicesForM365ComplianceCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForM365ComplianceCenterBeginUpdateOptions) (*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, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinkServicesForM365ComplianceCenterClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForM365ComplianceCenterBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365ComplianceCenter/{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-03-25-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 *PrivateLinkServicesForM365ComplianceCenterClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365securitycenter_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365securitycenter_client.go new file mode 100644 index 000000000000..cacd293df084 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesform365securitycenter_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 armm365securityandcompliance + +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" +) + +// PrivateLinkServicesForM365SecurityCenterClient contains the methods for the PrivateLinkServicesForM365SecurityCenter group. +// Don't use this type directly, use NewPrivateLinkServicesForM365SecurityCenterClient() instead. +type PrivateLinkServicesForM365SecurityCenterClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkServicesForM365SecurityCenterClient creates a new instance of PrivateLinkServicesForM365SecurityCenterClient with the specified values. +func NewPrivateLinkServicesForM365SecurityCenterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesForM365SecurityCenterClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesForM365SecurityCenterClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the metadata of a privateLinkServicesForM365SecurityCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForM365SecurityCenterDescription PrivateLinkServicesForM365SecurityCenterDescription, options *PrivateLinkServicesForM365SecurityCenterBeginCreateOrUpdateOptions) (PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateLinkServicesForM365SecurityCenterDescription, options) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForM365SecurityCenterClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a privateLinkServicesForM365SecurityCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForM365SecurityCenterDescription PrivateLinkServicesForM365SecurityCenterDescription, options *PrivateLinkServicesForM365SecurityCenterBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateLinkServicesForM365SecurityCenterDescription, 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 *PrivateLinkServicesForM365SecurityCenterClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForM365SecurityCenterDescription PrivateLinkServicesForM365SecurityCenterDescription, options *PrivateLinkServicesForM365SecurityCenterBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateLinkServicesForM365SecurityCenterDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) 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 *PrivateLinkServicesForM365SecurityCenterClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365SecurityCenterBeginDeleteOptions) (PrivateLinkServicesForM365SecurityCenterDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterDeletePollerResponse{}, err + } + result := PrivateLinkServicesForM365SecurityCenterDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForM365SecurityCenterClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterDeletePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForM365SecurityCenterDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365SecurityCenterBeginDeleteOptions) (*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.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinkServicesForM365SecurityCenterClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365SecurityCenterBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-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 *PrivateLinkServicesForM365SecurityCenterClient) 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 privateLinkServicesForM365SecurityCenter resource. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365SecurityCenterGetOptions) (PrivateLinkServicesForM365SecurityCenterGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesForM365SecurityCenterGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesForM365SecurityCenterClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForM365SecurityCenterGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesForM365SecurityCenterGetResponse, error) { + result := PrivateLinkServicesForM365SecurityCenterGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForM365SecurityCenterDescription); err != nil { + return PrivateLinkServicesForM365SecurityCenterGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) 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 privateLinkServicesForM365SecurityCenter instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) List(options *PrivateLinkServicesForM365SecurityCenterListOptions) *PrivateLinkServicesForM365SecurityCenterListPager { + return &PrivateLinkServicesForM365SecurityCenterListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForM365SecurityCenterListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForM365SecurityCenterDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesForM365SecurityCenterClient) listCreateRequest(ctx context.Context, options *PrivateLinkServicesForM365SecurityCenterListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesForM365SecurityCenterListResponse, error) { + result := PrivateLinkServicesForM365SecurityCenterListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForM365SecurityCenterDescriptionListResult); err != nil { + return PrivateLinkServicesForM365SecurityCenterListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) 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 *PrivateLinkServicesForM365SecurityCenterClient) ListByResourceGroup(resourceGroupName string, options *PrivateLinkServicesForM365SecurityCenterListByResourceGroupOptions) *PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager { + return &PrivateLinkServicesForM365SecurityCenterListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForM365SecurityCenterDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateLinkServicesForM365SecurityCenterClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForM365SecurityCenterListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse, error) { + result := PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForM365SecurityCenterDescriptionListResult); err != nil { + return PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *PrivateLinkServicesForM365SecurityCenterClient) 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 privateLinkServicesForM365SecurityCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForM365SecurityCenterBeginUpdateOptions) (PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForM365SecurityCenterClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForM365SecurityCenterUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a privateLinkServicesForM365SecurityCenter instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForM365SecurityCenterClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForM365SecurityCenterBeginUpdateOptions) (*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, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinkServicesForM365SecurityCenterClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForM365SecurityCenterBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForM365SecurityCenter/{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-03-25-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 *PrivateLinkServicesForM365SecurityCenterClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesformippolicysync_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesformippolicysync_client.go new file mode 100644 index 000000000000..6f1e90f06e6b --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesformippolicysync_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 armm365securityandcompliance + +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" +) + +// PrivateLinkServicesForMIPPolicySyncClient contains the methods for the PrivateLinkServicesForMIPPolicySync group. +// Don't use this type directly, use NewPrivateLinkServicesForMIPPolicySyncClient() instead. +type PrivateLinkServicesForMIPPolicySyncClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkServicesForMIPPolicySyncClient creates a new instance of PrivateLinkServicesForMIPPolicySyncClient with the specified values. +func NewPrivateLinkServicesForMIPPolicySyncClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesForMIPPolicySyncClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesForMIPPolicySyncClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the metadata of a privateLinkServicesForMIPPolicySync instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForMIPPolicySyncDescription PrivateLinkServicesForMIPPolicySyncDescription, options *PrivateLinkServicesForMIPPolicySyncBeginCreateOrUpdateOptions) (PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateLinkServicesForMIPPolicySyncDescription, options) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForMIPPolicySyncClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a privateLinkServicesForMIPPolicySync instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForMIPPolicySyncDescription PrivateLinkServicesForMIPPolicySyncDescription, options *PrivateLinkServicesForMIPPolicySyncBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateLinkServicesForMIPPolicySyncDescription, 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 *PrivateLinkServicesForMIPPolicySyncClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForMIPPolicySyncDescription PrivateLinkServicesForMIPPolicySyncDescription, options *PrivateLinkServicesForMIPPolicySyncBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateLinkServicesForMIPPolicySyncDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) 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 *PrivateLinkServicesForMIPPolicySyncClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForMIPPolicySyncBeginDeleteOptions) (PrivateLinkServicesForMIPPolicySyncDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncDeletePollerResponse{}, err + } + result := PrivateLinkServicesForMIPPolicySyncDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForMIPPolicySyncClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncDeletePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForMIPPolicySyncDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForMIPPolicySyncBeginDeleteOptions) (*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.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinkServicesForMIPPolicySyncClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForMIPPolicySyncBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-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 *PrivateLinkServicesForMIPPolicySyncClient) 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 privateLinkServicesForMIPPolicySync resource. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForMIPPolicySyncGetOptions) (PrivateLinkServicesForMIPPolicySyncGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesForMIPPolicySyncGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesForMIPPolicySyncClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForMIPPolicySyncGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesForMIPPolicySyncGetResponse, error) { + result := PrivateLinkServicesForMIPPolicySyncGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForMIPPolicySyncDescription); err != nil { + return PrivateLinkServicesForMIPPolicySyncGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) 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 privateLinkServicesForMIPPolicySync instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) List(options *PrivateLinkServicesForMIPPolicySyncListOptions) *PrivateLinkServicesForMIPPolicySyncListPager { + return &PrivateLinkServicesForMIPPolicySyncListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForMIPPolicySyncListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForMIPPolicySyncDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesForMIPPolicySyncClient) listCreateRequest(ctx context.Context, options *PrivateLinkServicesForMIPPolicySyncListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesForMIPPolicySyncListResponse, error) { + result := PrivateLinkServicesForMIPPolicySyncListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForMIPPolicySyncDescriptionListResult); err != nil { + return PrivateLinkServicesForMIPPolicySyncListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) 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 *PrivateLinkServicesForMIPPolicySyncClient) ListByResourceGroup(resourceGroupName string, options *PrivateLinkServicesForMIPPolicySyncListByResourceGroupOptions) *PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager { + return &PrivateLinkServicesForMIPPolicySyncListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForMIPPolicySyncDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateLinkServicesForMIPPolicySyncClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForMIPPolicySyncListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse, error) { + result := PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForMIPPolicySyncDescriptionListResult); err != nil { + return PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *PrivateLinkServicesForMIPPolicySyncClient) 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 privateLinkServicesForMIPPolicySync instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForMIPPolicySyncBeginUpdateOptions) (PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForMIPPolicySyncClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForMIPPolicySyncUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a privateLinkServicesForMIPPolicySync instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForMIPPolicySyncClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForMIPPolicySyncBeginUpdateOptions) (*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, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinkServicesForMIPPolicySyncClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForMIPPolicySyncBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForMIPPolicySync/{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-03-25-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 *PrivateLinkServicesForMIPPolicySyncClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforo365managementactivityapi_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforo365managementactivityapi_client.go new file mode 100644 index 000000000000..630d9a341a3c --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforo365managementactivityapi_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 armm365securityandcompliance + +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" +) + +// PrivateLinkServicesForO365ManagementActivityAPIClient contains the methods for the PrivateLinkServicesForO365ManagementActivityAPI group. +// Don't use this type directly, use NewPrivateLinkServicesForO365ManagementActivityAPIClient() instead. +type PrivateLinkServicesForO365ManagementActivityAPIClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkServicesForO365ManagementActivityAPIClient creates a new instance of PrivateLinkServicesForO365ManagementActivityAPIClient with the specified values. +func NewPrivateLinkServicesForO365ManagementActivityAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesForO365ManagementActivityAPIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesForO365ManagementActivityAPIClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the metadata of a privateLinkServicesForO365ManagementActivityAPI instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForO365ManagementActivityAPIDescription PrivateLinkServicesForO365ManagementActivityAPIDescription, options *PrivateLinkServicesForO365ManagementActivityAPIBeginCreateOrUpdateOptions) (PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateLinkServicesForO365ManagementActivityAPIDescription, options) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForO365ManagementActivityAPIClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a privateLinkServicesForO365ManagementActivityAPI instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForO365ManagementActivityAPIDescription PrivateLinkServicesForO365ManagementActivityAPIDescription, options *PrivateLinkServicesForO365ManagementActivityAPIBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateLinkServicesForO365ManagementActivityAPIDescription, 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 *PrivateLinkServicesForO365ManagementActivityAPIClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForO365ManagementActivityAPIDescription PrivateLinkServicesForO365ManagementActivityAPIDescription, options *PrivateLinkServicesForO365ManagementActivityAPIBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateLinkServicesForO365ManagementActivityAPIDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) 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 *PrivateLinkServicesForO365ManagementActivityAPIClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForO365ManagementActivityAPIBeginDeleteOptions) (PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse{}, err + } + result := PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForO365ManagementActivityAPIClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForO365ManagementActivityAPIDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForO365ManagementActivityAPIBeginDeleteOptions) (*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.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForO365ManagementActivityAPIBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-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 *PrivateLinkServicesForO365ManagementActivityAPIClient) 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 privateLinkServicesForO365ManagementActivityAPI resource. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForO365ManagementActivityAPIGetOptions) (PrivateLinkServicesForO365ManagementActivityAPIGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesForO365ManagementActivityAPIGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForO365ManagementActivityAPIGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesForO365ManagementActivityAPIGetResponse, error) { + result := PrivateLinkServicesForO365ManagementActivityAPIGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForO365ManagementActivityAPIDescription); err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) 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 privateLinkServicesForO365ManagementActivityAPI instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) List(options *PrivateLinkServicesForO365ManagementActivityAPIListOptions) *PrivateLinkServicesForO365ManagementActivityAPIListPager { + return &PrivateLinkServicesForO365ManagementActivityAPIListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForO365ManagementActivityAPIListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) listCreateRequest(ctx context.Context, options *PrivateLinkServicesForO365ManagementActivityAPIListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesForO365ManagementActivityAPIListResponse, error) { + result := PrivateLinkServicesForO365ManagementActivityAPIListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult); err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) 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 *PrivateLinkServicesForO365ManagementActivityAPIClient) ListByResourceGroup(resourceGroupName string, options *PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupOptions) *PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager { + return &PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse, error) { + result := PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult); err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) 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 privateLinkServicesForO365ManagementActivityAPI instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForO365ManagementActivityAPIBeginUpdateOptions) (PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForO365ManagementActivityAPIClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a privateLinkServicesForO365ManagementActivityAPI instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForO365ManagementActivityAPIBeginUpdateOptions) (*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, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinkServicesForO365ManagementActivityAPIClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForO365ManagementActivityAPIBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{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-03-25-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 *PrivateLinkServicesForO365ManagementActivityAPIClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforsccpowershell_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforsccpowershell_client.go new file mode 100644 index 000000000000..60e524bcdee7 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privatelinkservicesforsccpowershell_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 armm365securityandcompliance + +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" +) + +// PrivateLinkServicesForSCCPowershellClient contains the methods for the PrivateLinkServicesForSCCPowershell group. +// Don't use this type directly, use NewPrivateLinkServicesForSCCPowershellClient() instead. +type PrivateLinkServicesForSCCPowershellClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkServicesForSCCPowershellClient creates a new instance of PrivateLinkServicesForSCCPowershellClient with the specified values. +func NewPrivateLinkServicesForSCCPowershellClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesForSCCPowershellClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesForSCCPowershellClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the metadata of a privateLinkServicesForSCCPowershell instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForSCCPowershellDescription PrivateLinkServicesForSCCPowershellDescription, options *PrivateLinkServicesForSCCPowershellBeginCreateOrUpdateOptions) (PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateLinkServicesForSCCPowershellDescription, options) + if err != nil { + return PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForSCCPowershellClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the metadata of a privateLinkServicesForSCCPowershell instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForSCCPowershellDescription PrivateLinkServicesForSCCPowershellDescription, options *PrivateLinkServicesForSCCPowershellBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateLinkServicesForSCCPowershellDescription, 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 *PrivateLinkServicesForSCCPowershellClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateLinkServicesForSCCPowershellDescription PrivateLinkServicesForSCCPowershellDescription, options *PrivateLinkServicesForSCCPowershellBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateLinkServicesForSCCPowershellDescription) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateLinkServicesForSCCPowershellClient) 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 *PrivateLinkServicesForSCCPowershellClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForSCCPowershellBeginDeleteOptions) (PrivateLinkServicesForSCCPowershellDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForSCCPowershellDeletePollerResponse{}, err + } + result := PrivateLinkServicesForSCCPowershellDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForSCCPowershellClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateLinkServicesForSCCPowershellDeletePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForSCCPowershellDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a service instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForSCCPowershellBeginDeleteOptions) (*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.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinkServicesForSCCPowershellClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForSCCPowershellBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-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 *PrivateLinkServicesForSCCPowershellClient) 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 privateLinkServicesForSCCPowershell resource. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForSCCPowershellGetOptions) (PrivateLinkServicesForSCCPowershellGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return PrivateLinkServicesForSCCPowershellGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesForSCCPowershellGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesForSCCPowershellGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesForSCCPowershellClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkServicesForSCCPowershellGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesForSCCPowershellClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesForSCCPowershellGetResponse, error) { + result := PrivateLinkServicesForSCCPowershellGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForSCCPowershellDescription); err != nil { + return PrivateLinkServicesForSCCPowershellGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkServicesForSCCPowershellClient) 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 privateLinkServicesForSCCPowershell instances in a subscription. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) List(options *PrivateLinkServicesForSCCPowershellListOptions) *PrivateLinkServicesForSCCPowershellListPager { + return &PrivateLinkServicesForSCCPowershellListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForSCCPowershellListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForSCCPowershellDescriptionListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesForSCCPowershellClient) listCreateRequest(ctx context.Context, options *PrivateLinkServicesForSCCPowershellListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesForSCCPowershellClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesForSCCPowershellListResponse, error) { + result := PrivateLinkServicesForSCCPowershellListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForSCCPowershellDescriptionListResult); err != nil { + return PrivateLinkServicesForSCCPowershellListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkServicesForSCCPowershellClient) 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 *PrivateLinkServicesForSCCPowershellClient) ListByResourceGroup(resourceGroupName string, options *PrivateLinkServicesForSCCPowershellListByResourceGroupOptions) *PrivateLinkServicesForSCCPowershellListByResourceGroupPager { + return &PrivateLinkServicesForSCCPowershellListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp PrivateLinkServicesForSCCPowershellListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateLinkServicesForSCCPowershellDescriptionListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PrivateLinkServicesForSCCPowershellClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesForSCCPowershellListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell" + 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-03-25-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PrivateLinkServicesForSCCPowershellClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesForSCCPowershellListByResourceGroupResponse, error) { + result := PrivateLinkServicesForSCCPowershellListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServicesForSCCPowershellDescriptionListResult); err != nil { + return PrivateLinkServicesForSCCPowershellListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *PrivateLinkServicesForSCCPowershellClient) 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 privateLinkServicesForSCCPowershell instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForSCCPowershellBeginUpdateOptions) (PrivateLinkServicesForSCCPowershellUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, resourceName, servicePatchDescription, options) + if err != nil { + return PrivateLinkServicesForSCCPowershellUpdatePollerResponse{}, err + } + result := PrivateLinkServicesForSCCPowershellUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateLinkServicesForSCCPowershellClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PrivateLinkServicesForSCCPowershellUpdatePollerResponse{}, err + } + result.Poller = &PrivateLinkServicesForSCCPowershellUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Update the metadata of a privateLinkServicesForSCCPowershell instance. +// If the operation fails it returns the *ErrorDetails error type. +func (client *PrivateLinkServicesForSCCPowershellClient) update(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForSCCPowershellBeginUpdateOptions) (*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, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinkServicesForSCCPowershellClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, servicePatchDescription ServicesPatchDescription, options *PrivateLinkServicesForSCCPowershellBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForSCCPowershell/{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-03-25-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 *PrivateLinkServicesForSCCPowershellClient) 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/m365securityandcompliance/armm365securityandcompliance/zz_generated_response_types.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_response_types.go new file mode 100644 index 000000000000..65345125ab93 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_response_types.go @@ -0,0 +1,2032 @@ +//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 armm365securityandcompliance + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// 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 { + OperationListResult +} + +// PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsAdtAPI.CreateOrUpdate. +type PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller + + // 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 PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsAdtAPICreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsAdtAPIClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsAdtAPIClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsAdtAPICreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsAdtAPI.CreateOrUpdate. +type PrivateEndpointConnectionsAdtAPICreateOrUpdateResponse struct { + PrivateEndpointConnectionsAdtAPICreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsAdtAPICreateOrUpdateResult contains the result from method PrivateEndpointConnectionsAdtAPI.CreateOrUpdate. +type PrivateEndpointConnectionsAdtAPICreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsAdtAPIDeletePollerResponse contains the response from method PrivateEndpointConnectionsAdtAPI.Delete. +type PrivateEndpointConnectionsAdtAPIDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsAdtAPIDeletePoller + + // 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 PrivateEndpointConnectionsAdtAPIDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsAdtAPIDeleteResponse, error) { + respType := PrivateEndpointConnectionsAdtAPIDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsAdtAPIDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsAdtAPIDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsAdtAPIClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsAdtAPIClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsAdtAPIDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsAdtAPIDeleteResponse contains the response from method PrivateEndpointConnectionsAdtAPI.Delete. +type PrivateEndpointConnectionsAdtAPIDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsAdtAPIGetResponse contains the response from method PrivateEndpointConnectionsAdtAPI.Get. +type PrivateEndpointConnectionsAdtAPIGetResponse struct { + PrivateEndpointConnectionsAdtAPIGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsAdtAPIGetResult contains the result from method PrivateEndpointConnectionsAdtAPI.Get. +type PrivateEndpointConnectionsAdtAPIGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsAdtAPIListByServiceResponse contains the response from method PrivateEndpointConnectionsAdtAPI.ListByService. +type PrivateEndpointConnectionsAdtAPIListByServiceResponse struct { + PrivateEndpointConnectionsAdtAPIListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsAdtAPIListByServiceResult contains the result from method PrivateEndpointConnectionsAdtAPI.ListByService. +type PrivateEndpointConnectionsAdtAPIListByServiceResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsComp.CreateOrUpdate. +type PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsCompCreateOrUpdatePoller + + // 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 PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCompCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsCompCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsCompCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsCompClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsCompClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsCompCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsCompCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsComp.CreateOrUpdate. +type PrivateEndpointConnectionsCompCreateOrUpdateResponse struct { + PrivateEndpointConnectionsCompCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsCompCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsComp.CreateOrUpdate. +type PrivateEndpointConnectionsCompCreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsCompDeletePollerResponse contains the response from method PrivateEndpointConnectionsComp.Delete. +type PrivateEndpointConnectionsCompDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsCompDeletePoller + + // 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 PrivateEndpointConnectionsCompDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCompDeleteResponse, error) { + respType := PrivateEndpointConnectionsCompDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsCompDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsCompDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsCompClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsCompClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsCompDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsCompDeleteResponse contains the response from method PrivateEndpointConnectionsComp.Delete. +type PrivateEndpointConnectionsCompDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsCompGetResponse contains the response from method PrivateEndpointConnectionsComp.Get. +type PrivateEndpointConnectionsCompGetResponse struct { + PrivateEndpointConnectionsCompGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsCompGetResult contains the result from method PrivateEndpointConnectionsComp.Get. +type PrivateEndpointConnectionsCompGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsCompListByServiceResponse contains the response from method PrivateEndpointConnectionsComp.ListByService. +type PrivateEndpointConnectionsCompListByServiceResponse struct { + PrivateEndpointConnectionsCompListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsCompListByServiceResult contains the result from method PrivateEndpointConnectionsComp.ListByService. +type PrivateEndpointConnectionsCompListByServiceResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsForEDM.CreateOrUpdate. +type PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsForEDMCreateOrUpdatePoller + + // 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 PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsForEDMCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsForEDMCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsForEDMCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsForEDMClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsForEDMClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsForEDMCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsForEDMCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsForEDM.CreateOrUpdate. +type PrivateEndpointConnectionsForEDMCreateOrUpdateResponse struct { + PrivateEndpointConnectionsForEDMCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForEDMCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsForEDM.CreateOrUpdate. +type PrivateEndpointConnectionsForEDMCreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsForEDMDeletePollerResponse contains the response from method PrivateEndpointConnectionsForEDM.Delete. +type PrivateEndpointConnectionsForEDMDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsForEDMDeletePoller + + // 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 PrivateEndpointConnectionsForEDMDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsForEDMDeleteResponse, error) { + respType := PrivateEndpointConnectionsForEDMDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsForEDMDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsForEDMDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsForEDMClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsForEDMClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsForEDMDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsForEDMDeleteResponse contains the response from method PrivateEndpointConnectionsForEDM.Delete. +type PrivateEndpointConnectionsForEDMDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForEDMGetResponse contains the response from method PrivateEndpointConnectionsForEDM.Get. +type PrivateEndpointConnectionsForEDMGetResponse struct { + PrivateEndpointConnectionsForEDMGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForEDMGetResult contains the result from method PrivateEndpointConnectionsForEDM.Get. +type PrivateEndpointConnectionsForEDMGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsForEDMListByServiceResponse contains the response from method PrivateEndpointConnectionsForEDM.ListByService. +type PrivateEndpointConnectionsForEDMListByServiceResponse struct { + PrivateEndpointConnectionsForEDMListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForEDMListByServiceResult contains the result from method PrivateEndpointConnectionsForEDM.ListByService. +type PrivateEndpointConnectionsForEDMListByServiceResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsForMIPPolicySync.CreateOrUpdate. +type PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller + + // 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 PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsForMIPPolicySyncClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsForMIPPolicySyncClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsForMIPPolicySync.CreateOrUpdate. +type PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResponse struct { + PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsForMIPPolicySync.CreateOrUpdate. +type PrivateEndpointConnectionsForMIPPolicySyncCreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse contains the response from method PrivateEndpointConnectionsForMIPPolicySync.Delete. +type PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsForMIPPolicySyncDeletePoller + + // 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 PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse, error) { + respType := PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsForMIPPolicySyncDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsForMIPPolicySyncClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsForMIPPolicySyncClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsForMIPPolicySyncDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse contains the response from method PrivateEndpointConnectionsForMIPPolicySync.Delete. +type PrivateEndpointConnectionsForMIPPolicySyncDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForMIPPolicySyncGetResponse contains the response from method PrivateEndpointConnectionsForMIPPolicySync.Get. +type PrivateEndpointConnectionsForMIPPolicySyncGetResponse struct { + PrivateEndpointConnectionsForMIPPolicySyncGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForMIPPolicySyncGetResult contains the result from method PrivateEndpointConnectionsForMIPPolicySync.Get. +type PrivateEndpointConnectionsForMIPPolicySyncGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse contains the response from method PrivateEndpointConnectionsForMIPPolicySync.ListByService. +type PrivateEndpointConnectionsForMIPPolicySyncListByServiceResponse struct { + PrivateEndpointConnectionsForMIPPolicySyncListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForMIPPolicySyncListByServiceResult contains the result from method PrivateEndpointConnectionsForMIPPolicySync.ListByService. +type PrivateEndpointConnectionsForMIPPolicySyncListByServiceResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsForSCCPowershell.CreateOrUpdate. +type PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller + + // 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 PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsForSCCPowershellClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsForSCCPowershellClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsForSCCPowershellCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsForSCCPowershell.CreateOrUpdate. +type PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResponse struct { + PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsForSCCPowershell.CreateOrUpdate. +type PrivateEndpointConnectionsForSCCPowershellCreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse contains the response from method PrivateEndpointConnectionsForSCCPowershell.Delete. +type PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsForSCCPowershellDeletePoller + + // 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 PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsForSCCPowershellDeleteResponse, error) { + respType := PrivateEndpointConnectionsForSCCPowershellDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsForSCCPowershellDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsForSCCPowershellClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsForSCCPowershellClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsForSCCPowershellDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsForSCCPowershellDeleteResponse contains the response from method PrivateEndpointConnectionsForSCCPowershell.Delete. +type PrivateEndpointConnectionsForSCCPowershellDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForSCCPowershellGetResponse contains the response from method PrivateEndpointConnectionsForSCCPowershell.Get. +type PrivateEndpointConnectionsForSCCPowershellGetResponse struct { + PrivateEndpointConnectionsForSCCPowershellGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForSCCPowershellGetResult contains the result from method PrivateEndpointConnectionsForSCCPowershell.Get. +type PrivateEndpointConnectionsForSCCPowershellGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsForSCCPowershellListByServiceResponse contains the response from method PrivateEndpointConnectionsForSCCPowershell.ListByService. +type PrivateEndpointConnectionsForSCCPowershellListByServiceResponse struct { + PrivateEndpointConnectionsForSCCPowershellListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsForSCCPowershellListByServiceResult contains the result from method PrivateEndpointConnectionsForSCCPowershell.ListByService. +type PrivateEndpointConnectionsForSCCPowershellListByServiceResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse contains the response from method PrivateEndpointConnectionsSec.CreateOrUpdate. +type PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsSecCreateOrUpdatePoller + + // 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 PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsSecCreateOrUpdateResponse, error) { + respType := PrivateEndpointConnectionsSecCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsSecCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsSecClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsSecClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsSecCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsSecCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsSec.CreateOrUpdate. +type PrivateEndpointConnectionsSecCreateOrUpdateResponse struct { + PrivateEndpointConnectionsSecCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsSecCreateOrUpdateResult contains the result from method PrivateEndpointConnectionsSec.CreateOrUpdate. +type PrivateEndpointConnectionsSecCreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsSecDeletePollerResponse contains the response from method PrivateEndpointConnectionsSec.Delete. +type PrivateEndpointConnectionsSecDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointConnectionsSecDeletePoller + + // 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 PrivateEndpointConnectionsSecDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsSecDeleteResponse, error) { + respType := PrivateEndpointConnectionsSecDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointConnectionsSecDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointConnectionsSecDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointConnectionsSecClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointConnectionsSecClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointConnectionsSecDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointConnectionsSecDeleteResponse contains the response from method PrivateEndpointConnectionsSec.Delete. +type PrivateEndpointConnectionsSecDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsSecGetResponse contains the response from method PrivateEndpointConnectionsSec.Get. +type PrivateEndpointConnectionsSecGetResponse struct { + PrivateEndpointConnectionsSecGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsSecGetResult contains the result from method PrivateEndpointConnectionsSec.Get. +type PrivateEndpointConnectionsSecGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsSecListByServiceResponse contains the response from method PrivateEndpointConnectionsSec.ListByService. +type PrivateEndpointConnectionsSecListByServiceResponse struct { + PrivateEndpointConnectionsSecListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsSecListByServiceResult contains the result from method PrivateEndpointConnectionsSec.ListByService. +type PrivateEndpointConnectionsSecListByServiceResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateLinkResourcesAdtAPIGetResponse contains the response from method PrivateLinkResourcesAdtAPI.Get. +type PrivateLinkResourcesAdtAPIGetResponse struct { + PrivateLinkResourcesAdtAPIGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesAdtAPIGetResult contains the result from method PrivateLinkResourcesAdtAPI.Get. +type PrivateLinkResourcesAdtAPIGetResult struct { + PrivateLinkResource +} + +// PrivateLinkResourcesAdtAPIListByServiceResponse contains the response from method PrivateLinkResourcesAdtAPI.ListByService. +type PrivateLinkResourcesAdtAPIListByServiceResponse struct { + PrivateLinkResourcesAdtAPIListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesAdtAPIListByServiceResult contains the result from method PrivateLinkResourcesAdtAPI.ListByService. +type PrivateLinkResourcesAdtAPIListByServiceResult struct { + PrivateLinkResourceListResult +} + +// PrivateLinkResourcesCompGetResponse contains the response from method PrivateLinkResourcesComp.Get. +type PrivateLinkResourcesCompGetResponse struct { + PrivateLinkResourcesCompGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesCompGetResult contains the result from method PrivateLinkResourcesComp.Get. +type PrivateLinkResourcesCompGetResult struct { + PrivateLinkResource +} + +// PrivateLinkResourcesCompListByServiceResponse contains the response from method PrivateLinkResourcesComp.ListByService. +type PrivateLinkResourcesCompListByServiceResponse struct { + PrivateLinkResourcesCompListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesCompListByServiceResult contains the result from method PrivateLinkResourcesComp.ListByService. +type PrivateLinkResourcesCompListByServiceResult struct { + PrivateLinkResourceListResult +} + +// PrivateLinkResourcesForMIPPolicySyncGetResponse contains the response from method PrivateLinkResourcesForMIPPolicySync.Get. +type PrivateLinkResourcesForMIPPolicySyncGetResponse struct { + PrivateLinkResourcesForMIPPolicySyncGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesForMIPPolicySyncGetResult contains the result from method PrivateLinkResourcesForMIPPolicySync.Get. +type PrivateLinkResourcesForMIPPolicySyncGetResult struct { + PrivateLinkResource +} + +// PrivateLinkResourcesForMIPPolicySyncListByServiceResponse contains the response from method PrivateLinkResourcesForMIPPolicySync.ListByService. +type PrivateLinkResourcesForMIPPolicySyncListByServiceResponse struct { + PrivateLinkResourcesForMIPPolicySyncListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesForMIPPolicySyncListByServiceResult contains the result from method PrivateLinkResourcesForMIPPolicySync.ListByService. +type PrivateLinkResourcesForMIPPolicySyncListByServiceResult struct { + PrivateLinkResourceListResult +} + +// PrivateLinkResourcesForSCCPowershellGetResponse contains the response from method PrivateLinkResourcesForSCCPowershell.Get. +type PrivateLinkResourcesForSCCPowershellGetResponse struct { + PrivateLinkResourcesForSCCPowershellGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesForSCCPowershellGetResult contains the result from method PrivateLinkResourcesForSCCPowershell.Get. +type PrivateLinkResourcesForSCCPowershellGetResult struct { + PrivateLinkResource +} + +// PrivateLinkResourcesForSCCPowershellListByServiceResponse contains the response from method PrivateLinkResourcesForSCCPowershell.ListByService. +type PrivateLinkResourcesForSCCPowershellListByServiceResponse struct { + PrivateLinkResourcesForSCCPowershellListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesForSCCPowershellListByServiceResult contains the result from method PrivateLinkResourcesForSCCPowershell.ListByService. +type PrivateLinkResourcesForSCCPowershellListByServiceResult struct { + PrivateLinkResourceListResult +} + +// 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 { + PrivateLinkResource +} + +// 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 { + PrivateLinkResourceListResult +} + +// PrivateLinkResourcesSecGetResponse contains the response from method PrivateLinkResourcesSec.Get. +type PrivateLinkResourcesSecGetResponse struct { + PrivateLinkResourcesSecGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesSecGetResult contains the result from method PrivateLinkResourcesSec.Get. +type PrivateLinkResourcesSecGetResult struct { + PrivateLinkResource +} + +// PrivateLinkResourcesSecListByServiceResponse contains the response from method PrivateLinkResourcesSec.ListByService. +type PrivateLinkResourcesSecListByServiceResponse struct { + PrivateLinkResourcesSecListByServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesSecListByServiceResult contains the result from method PrivateLinkResourcesSec.ListByService. +type PrivateLinkResourcesSecListByServiceResult struct { + PrivateLinkResourceListResult +} + +// PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse contains the response from method PrivateLinkServicesForEDMUpload.CreateOrUpdate. +type PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForEDMUploadCreateOrUpdatePoller + + // 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 PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForEDMUploadCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForEDMUploadCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForEDMUploadDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForEDMUploadCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForEDMUploadClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForEDMUploadClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForEDMUploadCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForEDMUploadCreateOrUpdateResponse contains the response from method PrivateLinkServicesForEDMUpload.CreateOrUpdate. +type PrivateLinkServicesForEDMUploadCreateOrUpdateResponse struct { + PrivateLinkServicesForEDMUploadCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForEDMUploadCreateOrUpdateResult contains the result from method PrivateLinkServicesForEDMUpload.CreateOrUpdate. +type PrivateLinkServicesForEDMUploadCreateOrUpdateResult struct { + PrivateLinkServicesForEDMUploadDescription +} + +// PrivateLinkServicesForEDMUploadGetResponse contains the response from method PrivateLinkServicesForEDMUpload.Get. +type PrivateLinkServicesForEDMUploadGetResponse struct { + PrivateLinkServicesForEDMUploadGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForEDMUploadGetResult contains the result from method PrivateLinkServicesForEDMUpload.Get. +type PrivateLinkServicesForEDMUploadGetResult struct { + PrivateLinkServicesForEDMUploadDescription +} + +// PrivateLinkServicesForEDMUploadListByResourceGroupResponse contains the response from method PrivateLinkServicesForEDMUpload.ListByResourceGroup. +type PrivateLinkServicesForEDMUploadListByResourceGroupResponse struct { + PrivateLinkServicesForEDMUploadListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForEDMUploadListByResourceGroupResult contains the result from method PrivateLinkServicesForEDMUpload.ListByResourceGroup. +type PrivateLinkServicesForEDMUploadListByResourceGroupResult struct { + PrivateLinkServicesForEDMUploadDescriptionListResult +} + +// PrivateLinkServicesForEDMUploadListResponse contains the response from method PrivateLinkServicesForEDMUpload.List. +type PrivateLinkServicesForEDMUploadListResponse struct { + PrivateLinkServicesForEDMUploadListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForEDMUploadListResult contains the result from method PrivateLinkServicesForEDMUpload.List. +type PrivateLinkServicesForEDMUploadListResult struct { + PrivateLinkServicesForEDMUploadDescriptionListResult +} + +// PrivateLinkServicesForEDMUploadUpdatePollerResponse contains the response from method PrivateLinkServicesForEDMUpload.Update. +type PrivateLinkServicesForEDMUploadUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForEDMUploadUpdatePoller + + // 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 PrivateLinkServicesForEDMUploadUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForEDMUploadUpdateResponse, error) { + respType := PrivateLinkServicesForEDMUploadUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForEDMUploadDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForEDMUploadUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForEDMUploadUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForEDMUploadClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForEDMUploadClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForEDMUploadUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForEDMUploadUpdateResponse contains the response from method PrivateLinkServicesForEDMUpload.Update. +type PrivateLinkServicesForEDMUploadUpdateResponse struct { + PrivateLinkServicesForEDMUploadUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForEDMUploadUpdateResult contains the result from method PrivateLinkServicesForEDMUpload.Update. +type PrivateLinkServicesForEDMUploadUpdateResult struct { + PrivateLinkServicesForEDMUploadDescription +} + +// PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.CreateOrUpdate. +type PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller + + // 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 PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForM365ComplianceCenterDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForM365ComplianceCenterClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForM365ComplianceCenterClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForM365ComplianceCenterCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.CreateOrUpdate. +type PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResponse struct { + PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResult contains the result from method PrivateLinkServicesForM365ComplianceCenter.CreateOrUpdate. +type PrivateLinkServicesForM365ComplianceCenterCreateOrUpdateResult struct { + PrivateLinkServicesForM365ComplianceCenterDescription +} + +// PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.Delete. +type PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForM365ComplianceCenterDeletePoller + + // 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 PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForM365ComplianceCenterDeleteResponse, error) { + respType := PrivateLinkServicesForM365ComplianceCenterDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForM365ComplianceCenterDeletePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForM365ComplianceCenterClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForM365ComplianceCenterClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForM365ComplianceCenterDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForM365ComplianceCenterDeleteResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.Delete. +type PrivateLinkServicesForM365ComplianceCenterDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365ComplianceCenterGetResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.Get. +type PrivateLinkServicesForM365ComplianceCenterGetResponse struct { + PrivateLinkServicesForM365ComplianceCenterGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365ComplianceCenterGetResult contains the result from method PrivateLinkServicesForM365ComplianceCenter.Get. +type PrivateLinkServicesForM365ComplianceCenterGetResult struct { + PrivateLinkServicesForM365ComplianceCenterDescription +} + +// PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.ListByResourceGroup. +type PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResponse struct { + PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResult contains the result from method PrivateLinkServicesForM365ComplianceCenter.ListByResourceGroup. +type PrivateLinkServicesForM365ComplianceCenterListByResourceGroupResult struct { + PrivateLinkServicesForM365ComplianceCenterDescriptionListResult +} + +// PrivateLinkServicesForM365ComplianceCenterListResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.List. +type PrivateLinkServicesForM365ComplianceCenterListResponse struct { + PrivateLinkServicesForM365ComplianceCenterListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365ComplianceCenterListResult contains the result from method PrivateLinkServicesForM365ComplianceCenter.List. +type PrivateLinkServicesForM365ComplianceCenterListResult struct { + PrivateLinkServicesForM365ComplianceCenterDescriptionListResult +} + +// PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.Update. +type PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForM365ComplianceCenterUpdatePoller + + // 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 PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForM365ComplianceCenterUpdateResponse, error) { + respType := PrivateLinkServicesForM365ComplianceCenterUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForM365ComplianceCenterDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForM365ComplianceCenterUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForM365ComplianceCenterClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForM365ComplianceCenterClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForM365ComplianceCenterUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForM365ComplianceCenterUpdateResponse contains the response from method PrivateLinkServicesForM365ComplianceCenter.Update. +type PrivateLinkServicesForM365ComplianceCenterUpdateResponse struct { + PrivateLinkServicesForM365ComplianceCenterUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365ComplianceCenterUpdateResult contains the result from method PrivateLinkServicesForM365ComplianceCenter.Update. +type PrivateLinkServicesForM365ComplianceCenterUpdateResult struct { + PrivateLinkServicesForM365ComplianceCenterDescription +} + +// PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.CreateOrUpdate. +type PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller + + // 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 PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForM365SecurityCenterDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForM365SecurityCenterClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForM365SecurityCenterClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForM365SecurityCenterCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.CreateOrUpdate. +type PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResponse struct { + PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResult contains the result from method PrivateLinkServicesForM365SecurityCenter.CreateOrUpdate. +type PrivateLinkServicesForM365SecurityCenterCreateOrUpdateResult struct { + PrivateLinkServicesForM365SecurityCenterDescription +} + +// PrivateLinkServicesForM365SecurityCenterDeletePollerResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.Delete. +type PrivateLinkServicesForM365SecurityCenterDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForM365SecurityCenterDeletePoller + + // 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 PrivateLinkServicesForM365SecurityCenterDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForM365SecurityCenterDeleteResponse, error) { + respType := PrivateLinkServicesForM365SecurityCenterDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForM365SecurityCenterDeletePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForM365SecurityCenterDeletePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForM365SecurityCenterClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForM365SecurityCenterClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForM365SecurityCenterDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForM365SecurityCenterDeleteResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.Delete. +type PrivateLinkServicesForM365SecurityCenterDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365SecurityCenterGetResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.Get. +type PrivateLinkServicesForM365SecurityCenterGetResponse struct { + PrivateLinkServicesForM365SecurityCenterGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365SecurityCenterGetResult contains the result from method PrivateLinkServicesForM365SecurityCenter.Get. +type PrivateLinkServicesForM365SecurityCenterGetResult struct { + PrivateLinkServicesForM365SecurityCenterDescription +} + +// PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.ListByResourceGroup. +type PrivateLinkServicesForM365SecurityCenterListByResourceGroupResponse struct { + PrivateLinkServicesForM365SecurityCenterListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365SecurityCenterListByResourceGroupResult contains the result from method PrivateLinkServicesForM365SecurityCenter.ListByResourceGroup. +type PrivateLinkServicesForM365SecurityCenterListByResourceGroupResult struct { + PrivateLinkServicesForM365SecurityCenterDescriptionListResult +} + +// PrivateLinkServicesForM365SecurityCenterListResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.List. +type PrivateLinkServicesForM365SecurityCenterListResponse struct { + PrivateLinkServicesForM365SecurityCenterListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365SecurityCenterListResult contains the result from method PrivateLinkServicesForM365SecurityCenter.List. +type PrivateLinkServicesForM365SecurityCenterListResult struct { + PrivateLinkServicesForM365SecurityCenterDescriptionListResult +} + +// PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.Update. +type PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForM365SecurityCenterUpdatePoller + + // 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 PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForM365SecurityCenterUpdateResponse, error) { + respType := PrivateLinkServicesForM365SecurityCenterUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForM365SecurityCenterDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForM365SecurityCenterUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForM365SecurityCenterClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForM365SecurityCenterClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForM365SecurityCenterUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForM365SecurityCenterUpdateResponse contains the response from method PrivateLinkServicesForM365SecurityCenter.Update. +type PrivateLinkServicesForM365SecurityCenterUpdateResponse struct { + PrivateLinkServicesForM365SecurityCenterUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForM365SecurityCenterUpdateResult contains the result from method PrivateLinkServicesForM365SecurityCenter.Update. +type PrivateLinkServicesForM365SecurityCenterUpdateResult struct { + PrivateLinkServicesForM365SecurityCenterDescription +} + +// PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse contains the response from method PrivateLinkServicesForMIPPolicySync.CreateOrUpdate. +type PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller + + // 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 PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForMIPPolicySyncDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForMIPPolicySyncClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForMIPPolicySyncClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForMIPPolicySyncCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse contains the response from method PrivateLinkServicesForMIPPolicySync.CreateOrUpdate. +type PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResponse struct { + PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResult contains the result from method PrivateLinkServicesForMIPPolicySync.CreateOrUpdate. +type PrivateLinkServicesForMIPPolicySyncCreateOrUpdateResult struct { + PrivateLinkServicesForMIPPolicySyncDescription +} + +// PrivateLinkServicesForMIPPolicySyncDeletePollerResponse contains the response from method PrivateLinkServicesForMIPPolicySync.Delete. +type PrivateLinkServicesForMIPPolicySyncDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForMIPPolicySyncDeletePoller + + // 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 PrivateLinkServicesForMIPPolicySyncDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForMIPPolicySyncDeleteResponse, error) { + respType := PrivateLinkServicesForMIPPolicySyncDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForMIPPolicySyncDeletePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForMIPPolicySyncDeletePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForMIPPolicySyncClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForMIPPolicySyncClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForMIPPolicySyncDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForMIPPolicySyncDeleteResponse contains the response from method PrivateLinkServicesForMIPPolicySync.Delete. +type PrivateLinkServicesForMIPPolicySyncDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForMIPPolicySyncGetResponse contains the response from method PrivateLinkServicesForMIPPolicySync.Get. +type PrivateLinkServicesForMIPPolicySyncGetResponse struct { + PrivateLinkServicesForMIPPolicySyncGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForMIPPolicySyncGetResult contains the result from method PrivateLinkServicesForMIPPolicySync.Get. +type PrivateLinkServicesForMIPPolicySyncGetResult struct { + PrivateLinkServicesForMIPPolicySyncDescription +} + +// PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse contains the response from method PrivateLinkServicesForMIPPolicySync.ListByResourceGroup. +type PrivateLinkServicesForMIPPolicySyncListByResourceGroupResponse struct { + PrivateLinkServicesForMIPPolicySyncListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForMIPPolicySyncListByResourceGroupResult contains the result from method PrivateLinkServicesForMIPPolicySync.ListByResourceGroup. +type PrivateLinkServicesForMIPPolicySyncListByResourceGroupResult struct { + PrivateLinkServicesForMIPPolicySyncDescriptionListResult +} + +// PrivateLinkServicesForMIPPolicySyncListResponse contains the response from method PrivateLinkServicesForMIPPolicySync.List. +type PrivateLinkServicesForMIPPolicySyncListResponse struct { + PrivateLinkServicesForMIPPolicySyncListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForMIPPolicySyncListResult contains the result from method PrivateLinkServicesForMIPPolicySync.List. +type PrivateLinkServicesForMIPPolicySyncListResult struct { + PrivateLinkServicesForMIPPolicySyncDescriptionListResult +} + +// PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse contains the response from method PrivateLinkServicesForMIPPolicySync.Update. +type PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForMIPPolicySyncUpdatePoller + + // 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 PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForMIPPolicySyncUpdateResponse, error) { + respType := PrivateLinkServicesForMIPPolicySyncUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForMIPPolicySyncDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForMIPPolicySyncUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForMIPPolicySyncClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForMIPPolicySyncClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForMIPPolicySyncUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForMIPPolicySyncUpdateResponse contains the response from method PrivateLinkServicesForMIPPolicySync.Update. +type PrivateLinkServicesForMIPPolicySyncUpdateResponse struct { + PrivateLinkServicesForMIPPolicySyncUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForMIPPolicySyncUpdateResult contains the result from method PrivateLinkServicesForMIPPolicySync.Update. +type PrivateLinkServicesForMIPPolicySyncUpdateResult struct { + PrivateLinkServicesForMIPPolicySyncDescription +} + +// PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.CreateOrUpdate. +type PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller + + // 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 PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForO365ManagementActivityAPIDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForO365ManagementActivityAPIClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForO365ManagementActivityAPIClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.CreateOrUpdate. +type PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResponse struct { + PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResult contains the result from method PrivateLinkServicesForO365ManagementActivityAPI.CreateOrUpdate. +type PrivateLinkServicesForO365ManagementActivityAPICreateOrUpdateResult struct { + PrivateLinkServicesForO365ManagementActivityAPIDescription +} + +// PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.Delete. +type PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForO365ManagementActivityAPIDeletePoller + + // 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 PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse, error) { + respType := PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForO365ManagementActivityAPIDeletePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForO365ManagementActivityAPIClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForO365ManagementActivityAPIClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForO365ManagementActivityAPIDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.Delete. +type PrivateLinkServicesForO365ManagementActivityAPIDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForO365ManagementActivityAPIGetResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.Get. +type PrivateLinkServicesForO365ManagementActivityAPIGetResponse struct { + PrivateLinkServicesForO365ManagementActivityAPIGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForO365ManagementActivityAPIGetResult contains the result from method PrivateLinkServicesForO365ManagementActivityAPI.Get. +type PrivateLinkServicesForO365ManagementActivityAPIGetResult struct { + PrivateLinkServicesForO365ManagementActivityAPIDescription +} + +// PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.ListByResourceGroup. +type PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResponse struct { + PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResult contains the result from method PrivateLinkServicesForO365ManagementActivityAPI.ListByResourceGroup. +type PrivateLinkServicesForO365ManagementActivityAPIListByResourceGroupResult struct { + PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult +} + +// PrivateLinkServicesForO365ManagementActivityAPIListResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.List. +type PrivateLinkServicesForO365ManagementActivityAPIListResponse struct { + PrivateLinkServicesForO365ManagementActivityAPIListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForO365ManagementActivityAPIListResult contains the result from method PrivateLinkServicesForO365ManagementActivityAPI.List. +type PrivateLinkServicesForO365ManagementActivityAPIListResult struct { + PrivateLinkServicesForO365ManagementActivityAPIDescriptionListResult +} + +// PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.Update. +type PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller + + // 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 PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse, error) { + respType := PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForO365ManagementActivityAPIDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForO365ManagementActivityAPIUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForO365ManagementActivityAPIClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForO365ManagementActivityAPIClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForO365ManagementActivityAPIUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse contains the response from method PrivateLinkServicesForO365ManagementActivityAPI.Update. +type PrivateLinkServicesForO365ManagementActivityAPIUpdateResponse struct { + PrivateLinkServicesForO365ManagementActivityAPIUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForO365ManagementActivityAPIUpdateResult contains the result from method PrivateLinkServicesForO365ManagementActivityAPI.Update. +type PrivateLinkServicesForO365ManagementActivityAPIUpdateResult struct { + PrivateLinkServicesForO365ManagementActivityAPIDescription +} + +// PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse contains the response from method PrivateLinkServicesForSCCPowershell.CreateOrUpdate. +type PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller + + // 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 PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse, error) { + respType := PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForSCCPowershellDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForSCCPowershellCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForSCCPowershellClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForSCCPowershellClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForSCCPowershellCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse contains the response from method PrivateLinkServicesForSCCPowershell.CreateOrUpdate. +type PrivateLinkServicesForSCCPowershellCreateOrUpdateResponse struct { + PrivateLinkServicesForSCCPowershellCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForSCCPowershellCreateOrUpdateResult contains the result from method PrivateLinkServicesForSCCPowershell.CreateOrUpdate. +type PrivateLinkServicesForSCCPowershellCreateOrUpdateResult struct { + PrivateLinkServicesForSCCPowershellDescription +} + +// PrivateLinkServicesForSCCPowershellDeletePollerResponse contains the response from method PrivateLinkServicesForSCCPowershell.Delete. +type PrivateLinkServicesForSCCPowershellDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForSCCPowershellDeletePoller + + // 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 PrivateLinkServicesForSCCPowershellDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForSCCPowershellDeleteResponse, error) { + respType := PrivateLinkServicesForSCCPowershellDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForSCCPowershellDeletePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForSCCPowershellDeletePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForSCCPowershellClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForSCCPowershellClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForSCCPowershellDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForSCCPowershellDeleteResponse contains the response from method PrivateLinkServicesForSCCPowershell.Delete. +type PrivateLinkServicesForSCCPowershellDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForSCCPowershellGetResponse contains the response from method PrivateLinkServicesForSCCPowershell.Get. +type PrivateLinkServicesForSCCPowershellGetResponse struct { + PrivateLinkServicesForSCCPowershellGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForSCCPowershellGetResult contains the result from method PrivateLinkServicesForSCCPowershell.Get. +type PrivateLinkServicesForSCCPowershellGetResult struct { + PrivateLinkServicesForSCCPowershellDescription +} + +// PrivateLinkServicesForSCCPowershellListByResourceGroupResponse contains the response from method PrivateLinkServicesForSCCPowershell.ListByResourceGroup. +type PrivateLinkServicesForSCCPowershellListByResourceGroupResponse struct { + PrivateLinkServicesForSCCPowershellListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForSCCPowershellListByResourceGroupResult contains the result from method PrivateLinkServicesForSCCPowershell.ListByResourceGroup. +type PrivateLinkServicesForSCCPowershellListByResourceGroupResult struct { + PrivateLinkServicesForSCCPowershellDescriptionListResult +} + +// PrivateLinkServicesForSCCPowershellListResponse contains the response from method PrivateLinkServicesForSCCPowershell.List. +type PrivateLinkServicesForSCCPowershellListResponse struct { + PrivateLinkServicesForSCCPowershellListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForSCCPowershellListResult contains the result from method PrivateLinkServicesForSCCPowershell.List. +type PrivateLinkServicesForSCCPowershellListResult struct { + PrivateLinkServicesForSCCPowershellDescriptionListResult +} + +// PrivateLinkServicesForSCCPowershellUpdatePollerResponse contains the response from method PrivateLinkServicesForSCCPowershell.Update. +type PrivateLinkServicesForSCCPowershellUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateLinkServicesForSCCPowershellUpdatePoller + + // 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 PrivateLinkServicesForSCCPowershellUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesForSCCPowershellUpdateResponse, error) { + respType := PrivateLinkServicesForSCCPowershellUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServicesForSCCPowershellDescription) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateLinkServicesForSCCPowershellUpdatePollerResponse from the provided client and resume token. +func (l *PrivateLinkServicesForSCCPowershellUpdatePollerResponse) Resume(ctx context.Context, client *PrivateLinkServicesForSCCPowershellClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateLinkServicesForSCCPowershellClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PrivateLinkServicesForSCCPowershellUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateLinkServicesForSCCPowershellUpdateResponse contains the response from method PrivateLinkServicesForSCCPowershell.Update. +type PrivateLinkServicesForSCCPowershellUpdateResponse struct { + PrivateLinkServicesForSCCPowershellUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkServicesForSCCPowershellUpdateResult contains the result from method PrivateLinkServicesForSCCPowershell.Update. +type PrivateLinkServicesForSCCPowershellUpdateResult struct { + PrivateLinkServicesForSCCPowershellDescription +} + +// 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 +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_services_client.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_services_client.go new file mode 100644 index 000000000000..5ce62f3fee17 --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_services_client.go @@ -0,0 +1,119 @@ +//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 armm365securityandcompliance + +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)} +} + +// 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", "location", 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.StatusOK, 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.M365SecurityAndCompliance/privateLinkServicesForEDMUpload/{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-03-25-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) +} diff --git a/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_time_rfc3339.go b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..5a3115504bad --- /dev/null +++ b/sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/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 armm365securityandcompliance + +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 +}