From 437010ebfb180d4604844824af7b7d76698234b4 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Fri, 4 Aug 2023 09:52:49 +0200 Subject: [PATCH 1/3] dependencies: updating to `v0.20230804.1074947` of `github.com/hashicorp/go-azure-sdk` --- go.mod | 2 +- go.sum | 4 +- .../2021-11-30/dedicatedhsms/client.go | 22 +- .../2021-11-30/dedicatedhsms/constants.go | 32 ++- .../method_dedicatedhsmcreateorupdate.go | 74 ++++++ ...hod_dedicatedhsmcreateorupdate_autorest.go | 79 ------- .../method_dedicatedhsmdelete.go | 71 ++++++ .../method_dedicatedhsmdelete_autorest.go | 78 ------- .../dedicatedhsms/method_dedicatedhsmget.go | 51 +++++ .../method_dedicatedhsmget_autorest.go | 68 ------ .../method_dedicatedhsmlistbyresourcegroup.go | 118 ++++++++++ ...edicatedhsmlistbyresourcegroup_autorest.go | 216 ------------------ .../method_dedicatedhsmlistbysubscription.go | 118 ++++++++++ ...dedicatedhsmlistbysubscription_autorest.go | 216 ------------------ ...istoutboundnetworkdependenciesendpoints.go | 89 ++++++++ ...ndnetworkdependenciesendpoints_autorest.go | 186 --------------- .../method_dedicatedhsmupdate.go | 73 ++++++ .../method_dedicatedhsmupdate_autorest.go | 79 ------- .../healthbot/2022-08-08/client.go | 21 +- .../healthbot/2022-08-08/healthbots/client.go | 22 +- .../2022-08-08/healthbots/constants.go | 19 +- .../healthbots/method_botscreate.go | 74 ++++++ .../healthbots/method_botscreate_autorest.go | 79 ------- .../healthbots/method_botsdelete.go | 71 ++++++ .../healthbots/method_botsdelete_autorest.go | 78 ------- .../2022-08-08/healthbots/method_botsget.go | 51 +++++ .../healthbots/method_botsget_autorest.go | 68 ------ .../2022-08-08/healthbots/method_botslist.go | 90 ++++++++ .../healthbots/method_botslist_autorest.go | 187 --------------- .../method_botslistbyresourcegroup.go | 90 ++++++++ ...method_botslistbyresourcegroup_autorest.go | 187 --------------- .../healthbots/method_botslistsecrets.go | 52 +++++ .../method_botslistsecrets_autorest.go | 69 ------ .../method_botsregenerateapijwtsecret.go | 52 +++++ ...hod_botsregenerateapijwtsecret_autorest.go | 69 ------ .../healthbots/method_botsupdate.go | 74 ++++++ .../healthbots/method_botsupdate_autorest.go | 79 ------- .../2022-11-10/machineextensions/client.go | 22 +- .../2022-11-10/machineextensions/constants.go | 19 +- .../method_createorupdate.go | 74 ++++++ .../method_createorupdate_autorest.go | 79 ------- .../machineextensions/method_delete.go | 71 ++++++ .../method_delete_autorest.go | 78 ------- .../machineextensions/method_get.go | 51 +++++ .../machineextensions/method_get_autorest.go | 68 ------ .../machineextensions/method_list.go | 117 ++++++++++ .../machineextensions/method_list_autorest.go | 215 ----------------- .../machineextensions/method_update.go | 74 ++++++ .../method_update_autorest.go | 79 ------- .../2022-11-10/machines/client.go | 22 +- .../2022-11-10/machines/constants.go | 84 ++++++- .../machines/method_createorupdate.go | 55 +++++ .../method_createorupdate_autorest.go | 69 ------ .../2022-11-10/machines/method_delete.go | 47 ++++ .../machines/method_delete_autorest.go | 66 ------ .../2022-11-10/machines/method_get.go | 80 +++++++ .../machines/method_get_autorest.go | 97 -------- .../machines/method_listbyresourcegroup.go | 90 ++++++++ .../method_listbyresourcegroup_autorest.go | 187 --------------- .../machines/method_listbysubscription.go | 90 ++++++++ .../method_listbysubscription_autorest.go | 187 --------------- .../2022-11-10/machines/method_update.go | 55 +++++ .../machines/method_update_autorest.go | 69 ------ .../privateendpointconnections/client.go | 22 +- .../method_createorupdate.go | 74 ++++++ .../method_createorupdate_autorest.go | 79 ------- .../method_delete.go | 71 ++++++ .../method_delete_autorest.go | 78 ------- .../privateendpointconnections/method_get.go | 51 +++++ .../method_get_autorest.go | 68 ------ .../method_listbyprivatelinkscope.go | 89 ++++++++ .../method_listbyprivatelinkscope_autorest.go | 186 --------------- .../2022-11-10/privatelinkscopes/client.go | 22 +- .../2022-11-10/privatelinkscopes/constants.go | 19 +- .../method_privatelinkscopescreateorupdate.go | 56 +++++ ...rivatelinkscopescreateorupdate_autorest.go | 69 ------ .../method_privatelinkscopesdelete.go | 71 ++++++ ...method_privatelinkscopesdelete_autorest.go | 78 ------- .../method_privatelinkscopesget.go | 51 +++++ .../method_privatelinkscopesget_autorest.go | 68 ------ ...d_privatelinkscopesgetvalidationdetails.go | 51 +++++ ...linkscopesgetvalidationdetails_autorest.go | 68 ------ ...inkscopesgetvalidationdetailsformachine.go | 52 +++++ ...getvalidationdetailsformachine_autorest.go | 69 ------ .../method_privatelinkscopeslist.go | 90 ++++++++ .../method_privatelinkscopeslist_autorest.go | 187 --------------- ...od_privatelinkscopeslistbyresourcegroup.go | 90 ++++++++ ...elinkscopeslistbyresourcegroup_autorest.go | 187 --------------- .../method_privatelinkscopesupdatetags.go | 55 +++++ ...od_privatelinkscopesupdatetags_autorest.go | 69 ------ .../2021-10-01/connectedclusters/client.go | 22 +- .../2021-10-01/connectedclusters/constants.go | 45 +++- .../method_connectedclustercreate.go | 74 ++++++ .../method_connectedclustercreate_autorest.go | 79 ------- .../method_connectedclusterdelete.go | 71 ++++++ .../method_connectedclusterdelete_autorest.go | 78 ------- .../method_connectedclusterget.go | 51 +++++ .../method_connectedclusterget_autorest.go | 68 ------ ...hod_connectedclusterlistbyresourcegroup.go | 90 ++++++++ ...ctedclusterlistbyresourcegroup_autorest.go | 187 --------------- ...thod_connectedclusterlistbysubscription.go | 90 ++++++++ ...ectedclusterlistbysubscription_autorest.go | 187 --------------- ...nnectedclusterlistclusterusercredential.go | 56 +++++ ...usterlistclusterusercredential_autorest.go | 70 ------ .../method_connectedclusterupdate.go | 55 +++++ .../method_connectedclusterupdate_autorest.go | 69 ------ .../sdk/client/resourcemanager/poller.go | 4 +- .../sdk/client/resourcemanager/poller_lro.go | 7 +- .../poller_provisioning_state.go | 17 +- vendor/modules.txt | 2 +- 110 files changed, 3591 insertions(+), 4954 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate_autorest.go diff --git a/go.mod b/go.mod index 7641ccae282e..72082e21f147 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 github.com/hashicorp/go-azure-helpers v0.57.0 - github.com/hashicorp/go-azure-sdk v0.20230803.1095722 + github.com/hashicorp/go-azure-sdk v0.20230804.1074947 github.com/hashicorp/go-hclog v1.4.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index a90498693b5f..0a1f1ce8bee8 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.57.0 h1:85CWEUtIjMtx8DaXisFbEb2GCWR4S2UZlYvJpSPYoZ4= github.com/hashicorp/go-azure-helpers v0.57.0/go.mod h1:BQUQp5udwbJ8pnzl0wByCLVEEyPMAFpJ9vOREiCzObo= -github.com/hashicorp/go-azure-sdk v0.20230803.1095722 h1:7q4DEAriywcH6BsE2XczLzwY8Y3x9vqh65d0RxVnjak= -github.com/hashicorp/go-azure-sdk v0.20230803.1095722/go.mod h1:iZrpp7qJSZxocEkr4SjslzxpDrhuRLmedyVGGcCPbhk= +github.com/hashicorp/go-azure-sdk v0.20230804.1074947 h1:3P1sGIY2J2RzUVCqjCaPcCBlsQyr/mYqIdTO7JXfLPg= +github.com/hashicorp/go-azure-sdk v0.20230804.1074947/go.mod h1:iZrpp7qJSZxocEkr4SjslzxpDrhuRLmedyVGGcCPbhk= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go index 186b5df4b1af..b8b62118f0bc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go @@ -1,18 +1,26 @@ package dedicatedhsms -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DedicatedHsmsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDedicatedHsmsClientWithBaseURI(endpoint string) DedicatedHsmsClient { - return DedicatedHsmsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDedicatedHsmsClientWithBaseURI(sdkApi sdkEnv.Api) (*DedicatedHsmsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "dedicatedhsms", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DedicatedHsmsClient: %+v", err) } + + return &DedicatedHsmsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go index f81a04d3248b..2b7ff4df78b3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go @@ -1,6 +1,10 @@ package dedicatedhsms -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForJsonWebKeyType() []string { } } +func (s *JsonWebKeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseJsonWebKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseJsonWebKeyType(input string) (*JsonWebKeyType, error) { vals := map[string]JsonWebKeyType{ "allocating": JsonWebKeyTypeAllocating, @@ -72,6 +89,19 @@ func PossibleValuesForSkuName() []string { } } +func (s *SkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuName(input string) (*SkuName, error) { vals := map[string]SkuName{ "payshield10k_lmk1_cps60": SkuNamePayShieldOneZeroKLMKOneCPSSixZero, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate.go new file mode 100644 index 000000000000..c6d3732cbe85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate.go @@ -0,0 +1,74 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DedicatedHsmCreateOrUpdate ... +func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (result DedicatedHsmCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DedicatedHsmCreateOrUpdateThenPoll performs DedicatedHsmCreateOrUpdate then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) error { + result, err := c.DedicatedHsmCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DedicatedHsmCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DedicatedHsmCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go deleted file mode 100644 index e5ccb166ebf8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmCreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DedicatedHsmCreateOrUpdate ... -func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (result DedicatedHsmCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForDedicatedHsmCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DedicatedHsmCreateOrUpdateThenPoll performs DedicatedHsmCreateOrUpdate then polls until it's completed -func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) error { - result, err := c.DedicatedHsmCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing DedicatedHsmCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DedicatedHsmCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForDedicatedHsmCreateOrUpdate prepares the DedicatedHsmCreateOrUpdate request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDedicatedHsmCreateOrUpdate sends the DedicatedHsmCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c DedicatedHsmsClient) senderForDedicatedHsmCreateOrUpdate(ctx context.Context, req *http.Request) (future DedicatedHsmCreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete.go new file mode 100644 index 000000000000..85a78459f8ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete.go @@ -0,0 +1,71 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DedicatedHsmDelete ... +func (c DedicatedHsmsClient) DedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DedicatedHsmDeleteThenPoll performs DedicatedHsmDelete then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmDeleteThenPoll(ctx context.Context, id DedicatedHSMId) error { + result, err := c.DedicatedHsmDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DedicatedHsmDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DedicatedHsmDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go deleted file mode 100644 index 3df0fbb55454..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DedicatedHsmDelete ... -func (c DedicatedHsmsClient) DedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmDeleteOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDedicatedHsmDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DedicatedHsmDeleteThenPoll performs DedicatedHsmDelete then polls until it's completed -func (c DedicatedHsmsClient) DedicatedHsmDeleteThenPoll(ctx context.Context, id DedicatedHSMId) error { - result, err := c.DedicatedHsmDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing DedicatedHsmDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DedicatedHsmDelete: %+v", err) - } - - return nil -} - -// preparerForDedicatedHsmDelete prepares the DedicatedHsmDelete request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDedicatedHsmDelete sends the DedicatedHsmDelete request. The method will close the -// http.Response Body if it receives an error. -func (c DedicatedHsmsClient) senderForDedicatedHsmDelete(ctx context.Context, req *http.Request) (future DedicatedHsmDeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget.go new file mode 100644 index 000000000000..ec9f54cd2476 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget.go @@ -0,0 +1,51 @@ +package dedicatedhsms + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHsm +} + +// DedicatedHsmGet ... +func (c DedicatedHsmsClient) DedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go deleted file mode 100644 index b0de63aecbc5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmGetOperationResponse struct { - HttpResponse *http.Response - Model *DedicatedHsm -} - -// DedicatedHsmGet ... -func (c DedicatedHsmsClient) DedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmGetOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDedicatedHsmGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDedicatedHsmGet prepares the DedicatedHsmGet request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDedicatedHsmGet handles the response to the DedicatedHsmGet request. The method always -// closes the http.Response Body. -func (c DedicatedHsmsClient) responderForDedicatedHsmGet(resp *http.Response) (result DedicatedHsmGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup.go new file mode 100644 index 000000000000..91a1f2c8d0a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup.go @@ -0,0 +1,118 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DedicatedHsm +} + +type DedicatedHsmListByResourceGroupCompleteResult struct { + Items []DedicatedHsm +} + +type DedicatedHsmListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultDedicatedHsmListByResourceGroupOperationOptions() DedicatedHsmListByResourceGroupOperationOptions { + return DedicatedHsmListByResourceGroupOperationOptions{} +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// DedicatedHsmListByResourceGroup ... +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (result DedicatedHsmListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DedicatedHsm `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DedicatedHsmListByResourceGroupComplete retrieves all the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (DedicatedHsmListByResourceGroupCompleteResult, error) { + return c.DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) +} + +// DedicatedHsmListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions, predicate DedicatedHsmOperationPredicate) (result DedicatedHsmListByResourceGroupCompleteResult, err error) { + items := make([]DedicatedHsm, 0) + + resp, err := c.DedicatedHsmListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = DedicatedHsmListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go deleted file mode 100644 index a0582dfc6f6f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go +++ /dev/null @@ -1,216 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]DedicatedHsm - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListByResourceGroupOperationResponse, error) -} - -type DedicatedHsmListByResourceGroupCompleteResult struct { - Items []DedicatedHsm -} - -func (r DedicatedHsmListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r DedicatedHsmListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type DedicatedHsmListByResourceGroupOperationOptions struct { - Top *int64 -} - -func DefaultDedicatedHsmListByResourceGroupOperationOptions() DedicatedHsmListByResourceGroupOperationOptions { - return DedicatedHsmListByResourceGroupOperationOptions{} -} - -func (o DedicatedHsmListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DedicatedHsmListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// DedicatedHsmListByResourceGroup ... -func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (resp DedicatedHsmListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmListByResourceGroup(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForDedicatedHsmListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForDedicatedHsmListByResourceGroup prepares the DedicatedHsmListByResourceGroup request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForDedicatedHsmListByResourceGroupWithNextLink prepares the DedicatedHsmListByResourceGroup request with the given nextLink token. -func (c DedicatedHsmsClient) preparerForDedicatedHsmListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDedicatedHsmListByResourceGroup handles the response to the DedicatedHsmListByResourceGroup request. The method always -// closes the http.Response Body. -func (c DedicatedHsmsClient) responderForDedicatedHsmListByResourceGroup(resp *http.Response) (result DedicatedHsmListByResourceGroupOperationResponse, err error) { - type page struct { - Values []DedicatedHsm `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result DedicatedHsmListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDedicatedHsmListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// DedicatedHsmListByResourceGroupComplete retrieves all of the results into a single object -func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (DedicatedHsmListByResourceGroupCompleteResult, error) { - return c.DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) -} - -// DedicatedHsmListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions, predicate DedicatedHsmOperationPredicate) (resp DedicatedHsmListByResourceGroupCompleteResult, err error) { - items := make([]DedicatedHsm, 0) - - page, err := c.DedicatedHsmListByResourceGroup(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := DedicatedHsmListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription.go new file mode 100644 index 000000000000..5571d90f8349 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription.go @@ -0,0 +1,118 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DedicatedHsm +} + +type DedicatedHsmListBySubscriptionCompleteResult struct { + Items []DedicatedHsm +} + +type DedicatedHsmListBySubscriptionOperationOptions struct { + Top *int64 +} + +func DefaultDedicatedHsmListBySubscriptionOperationOptions() DedicatedHsmListBySubscriptionOperationOptions { + return DedicatedHsmListBySubscriptionOperationOptions{} +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// DedicatedHsmListBySubscription ... +func (c DedicatedHsmsClient) DedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (result DedicatedHsmListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DedicatedHsm `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DedicatedHsmListBySubscriptionComplete retrieves all the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (DedicatedHsmListBySubscriptionCompleteResult, error) { + return c.DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) +} + +// DedicatedHsmListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions, predicate DedicatedHsmOperationPredicate) (result DedicatedHsmListBySubscriptionCompleteResult, err error) { + items := make([]DedicatedHsm, 0) + + resp, err := c.DedicatedHsmListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = DedicatedHsmListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go deleted file mode 100644 index 60a985837288..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go +++ /dev/null @@ -1,216 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]DedicatedHsm - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListBySubscriptionOperationResponse, error) -} - -type DedicatedHsmListBySubscriptionCompleteResult struct { - Items []DedicatedHsm -} - -func (r DedicatedHsmListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r DedicatedHsmListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type DedicatedHsmListBySubscriptionOperationOptions struct { - Top *int64 -} - -func DefaultDedicatedHsmListBySubscriptionOperationOptions() DedicatedHsmListBySubscriptionOperationOptions { - return DedicatedHsmListBySubscriptionOperationOptions{} -} - -func (o DedicatedHsmListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DedicatedHsmListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// DedicatedHsmListBySubscription ... -func (c DedicatedHsmsClient) DedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (resp DedicatedHsmListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmListBySubscription(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForDedicatedHsmListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForDedicatedHsmListBySubscription prepares the DedicatedHsmListBySubscription request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForDedicatedHsmListBySubscriptionWithNextLink prepares the DedicatedHsmListBySubscription request with the given nextLink token. -func (c DedicatedHsmsClient) preparerForDedicatedHsmListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDedicatedHsmListBySubscription handles the response to the DedicatedHsmListBySubscription request. The method always -// closes the http.Response Body. -func (c DedicatedHsmsClient) responderForDedicatedHsmListBySubscription(resp *http.Response) (result DedicatedHsmListBySubscriptionOperationResponse, err error) { - type page struct { - Values []DedicatedHsm `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result DedicatedHsmListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDedicatedHsmListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// DedicatedHsmListBySubscriptionComplete retrieves all of the results into a single object -func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (DedicatedHsmListBySubscriptionCompleteResult, error) { - return c.DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) -} - -// DedicatedHsmListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions, predicate DedicatedHsmOperationPredicate) (resp DedicatedHsmListBySubscriptionCompleteResult, err error) { - items := make([]DedicatedHsm, 0) - - page, err := c.DedicatedHsmListBySubscription(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := DedicatedHsmListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints.go new file mode 100644 index 000000000000..9191e31f646a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,89 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OutboundEnvironmentEndpoint +} + +type DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult struct { + Items []OutboundEnvironmentEndpoint +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpoints ... +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OutboundEnvironmentEndpoint `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete retrieves all the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id DedicatedHSMId) (DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id DedicatedHSMId, predicate OutboundEnvironmentEndpointOperationPredicate) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + resp, err := c.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go deleted file mode 100644 index 5444b844daff..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse struct { - HttpResponse *http.Response - Model *[]OutboundEnvironmentEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, error) -} - -type DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult struct { - Items []OutboundEnvironmentEndpoint -} - -func (r DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// DedicatedHsmListOutboundNetworkDependenciesEndpoints ... -func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints prepares the DedicatedHsmListOutboundNetworkDependenciesEndpoints request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink prepares the DedicatedHsmListOutboundNetworkDependenciesEndpoints request with the given nextLink token. -func (c DedicatedHsmsClient) preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints handles the response to the DedicatedHsmListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (c DedicatedHsmsClient) responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - type page struct { - Values []OutboundEnvironmentEndpoint `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object -func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id DedicatedHSMId) (DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, error) { - return c.DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) -} - -// DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id DedicatedHSMId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { - items := make([]OutboundEnvironmentEndpoint, 0) - - page, err := c.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate.go new file mode 100644 index 000000000000..b3d340ead3d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate.go @@ -0,0 +1,73 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DedicatedHsmUpdate ... +func (c DedicatedHsmsClient) DedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (result DedicatedHsmUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DedicatedHsmUpdateThenPoll performs DedicatedHsmUpdate then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) error { + result, err := c.DedicatedHsmUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DedicatedHsmUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DedicatedHsmUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go deleted file mode 100644 index da7dcc6070dd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package dedicatedhsms - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DedicatedHsmUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DedicatedHsmUpdate ... -func (c DedicatedHsmsClient) DedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (result DedicatedHsmUpdateOperationResponse, err error) { - req, err := c.preparerForDedicatedHsmUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForDedicatedHsmUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DedicatedHsmUpdateThenPoll performs DedicatedHsmUpdate then polls until it's completed -func (c DedicatedHsmsClient) DedicatedHsmUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) error { - result, err := c.DedicatedHsmUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing DedicatedHsmUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DedicatedHsmUpdate: %+v", err) - } - - return nil -} - -// preparerForDedicatedHsmUpdate prepares the DedicatedHsmUpdate request. -func (c DedicatedHsmsClient) preparerForDedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDedicatedHsmUpdate sends the DedicatedHsmUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c DedicatedHsmsClient) senderForDedicatedHsmUpdate(ctx context.Context, req *http.Request) (future DedicatedHsmUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/client.go index 45396374d7f7..3627f60deaca 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/client.go @@ -4,20 +4,25 @@ package v2022_08_08 // Licensed under the MIT License. See NOTICE.txt in the project root for license information. import ( - "github.com/Azure/go-autorest/autorest" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { Healthbots *healthbots.HealthbotsClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - healthbotsClient := healthbots.NewHealthbotsClientWithBaseURI(endpoint) - configureAuthFunc(&healthbotsClient.Client) - - return Client{ - Healthbots: &healthbotsClient, +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + healthbotsClient, err := healthbots.NewHealthbotsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Healthbots client: %+v", err) } + configureFunc(healthbotsClient.Client) + + return &Client{ + Healthbots: healthbotsClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/client.go index b143e9a3c07b..e9e7114f787e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/client.go @@ -1,18 +1,26 @@ package healthbots -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type HealthbotsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewHealthbotsClientWithBaseURI(endpoint string) HealthbotsClient { - return HealthbotsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewHealthbotsClientWithBaseURI(sdkApi sdkEnv.Api) (*HealthbotsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "healthbots", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating HealthbotsClient: %+v", err) } + + return &HealthbotsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/constants.go index ca5e425928c8..7d24602c84ab 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/constants.go @@ -1,6 +1,10 @@ package healthbots -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForSkuName() []string { } } +func (s *SkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuName(input string) (*SkuName, error) { vals := map[string]SkuName{ "c0": SkuNameCZero, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate.go new file mode 100644 index 000000000000..e18333f57d2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate.go @@ -0,0 +1,74 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsCreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BotsCreate ... +func (c HealthbotsClient) BotsCreate(ctx context.Context, id HealthBotId, input HealthBot) (result BotsCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BotsCreateThenPoll performs BotsCreate then polls until it's completed +func (c HealthbotsClient) BotsCreateThenPoll(ctx context.Context, id HealthBotId, input HealthBot) error { + result, err := c.BotsCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BotsCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BotsCreate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate_autorest.go deleted file mode 100644 index 1dc295fef300..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botscreate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsCreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// BotsCreate ... -func (c HealthbotsClient) BotsCreate(ctx context.Context, id HealthBotId, input HealthBot) (result BotsCreateOperationResponse, err error) { - req, err := c.preparerForBotsCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsCreate", nil, "Failure preparing request") - return - } - - result, err = c.senderForBotsCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsCreate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// BotsCreateThenPoll performs BotsCreate then polls until it's completed -func (c HealthbotsClient) BotsCreateThenPoll(ctx context.Context, id HealthBotId, input HealthBot) error { - result, err := c.BotsCreate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing BotsCreate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after BotsCreate: %+v", err) - } - - return nil -} - -// preparerForBotsCreate prepares the BotsCreate request. -func (c HealthbotsClient) preparerForBotsCreate(ctx context.Context, id HealthBotId, input HealthBot) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForBotsCreate sends the BotsCreate request. The method will close the -// http.Response Body if it receives an error. -func (c HealthbotsClient) senderForBotsCreate(ctx context.Context, req *http.Request) (future BotsCreateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete.go new file mode 100644 index 000000000000..867fb50af659 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete.go @@ -0,0 +1,71 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BotsDelete ... +func (c HealthbotsClient) BotsDelete(ctx context.Context, id HealthBotId) (result BotsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BotsDeleteThenPoll performs BotsDelete then polls until it's completed +func (c HealthbotsClient) BotsDeleteThenPoll(ctx context.Context, id HealthBotId) error { + result, err := c.BotsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing BotsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BotsDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete_autorest.go deleted file mode 100644 index 79065c91d186..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsdelete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// BotsDelete ... -func (c HealthbotsClient) BotsDelete(ctx context.Context, id HealthBotId) (result BotsDeleteOperationResponse, err error) { - req, err := c.preparerForBotsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForBotsDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// BotsDeleteThenPoll performs BotsDelete then polls until it's completed -func (c HealthbotsClient) BotsDeleteThenPoll(ctx context.Context, id HealthBotId) error { - result, err := c.BotsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing BotsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after BotsDelete: %+v", err) - } - - return nil -} - -// preparerForBotsDelete prepares the BotsDelete request. -func (c HealthbotsClient) preparerForBotsDelete(ctx context.Context, id HealthBotId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForBotsDelete sends the BotsDelete request. The method will close the -// http.Response Body if it receives an error. -func (c HealthbotsClient) senderForBotsDelete(ctx context.Context, req *http.Request) (future BotsDeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget.go new file mode 100644 index 000000000000..d5e7f701337f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget.go @@ -0,0 +1,51 @@ +package healthbots + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HealthBot +} + +// BotsGet ... +func (c HealthbotsClient) BotsGet(ctx context.Context, id HealthBotId) (result BotsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget_autorest.go deleted file mode 100644 index e40a0f1e2c44..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package healthbots - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsGetOperationResponse struct { - HttpResponse *http.Response - Model *HealthBot -} - -// BotsGet ... -func (c HealthbotsClient) BotsGet(ctx context.Context, id HealthBotId) (result BotsGetOperationResponse, err error) { - req, err := c.preparerForBotsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBotsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForBotsGet prepares the BotsGet request. -func (c HealthbotsClient) preparerForBotsGet(ctx context.Context, id HealthBotId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBotsGet handles the response to the BotsGet request. The method always -// closes the http.Response Body. -func (c HealthbotsClient) responderForBotsGet(resp *http.Response) (result BotsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist.go new file mode 100644 index 000000000000..d36e8ceb7f71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist.go @@ -0,0 +1,90 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]HealthBot +} + +type BotsListCompleteResult struct { + Items []HealthBot +} + +// BotsList ... +func (c HealthbotsClient) BotsList(ctx context.Context, id commonids.SubscriptionId) (result BotsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HealthBot/healthBots", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]HealthBot `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BotsListComplete retrieves all the results into a single object +func (c HealthbotsClient) BotsListComplete(ctx context.Context, id commonids.SubscriptionId) (BotsListCompleteResult, error) { + return c.BotsListCompleteMatchingPredicate(ctx, id, HealthBotOperationPredicate{}) +} + +// BotsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c HealthbotsClient) BotsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate HealthBotOperationPredicate) (result BotsListCompleteResult, err error) { + items := make([]HealthBot, 0) + + resp, err := c.BotsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = BotsListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist_autorest.go deleted file mode 100644 index cefd09d573a4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsListOperationResponse struct { - HttpResponse *http.Response - Model *[]HealthBot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (BotsListOperationResponse, error) -} - -type BotsListCompleteResult struct { - Items []HealthBot -} - -func (r BotsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r BotsListOperationResponse) LoadMore(ctx context.Context) (resp BotsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// BotsList ... -func (c HealthbotsClient) BotsList(ctx context.Context, id commonids.SubscriptionId) (resp BotsListOperationResponse, err error) { - req, err := c.preparerForBotsList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForBotsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForBotsList prepares the BotsList request. -func (c HealthbotsClient) preparerForBotsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HealthBot/healthBots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForBotsListWithNextLink prepares the BotsList request with the given nextLink token. -func (c HealthbotsClient) preparerForBotsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBotsList handles the response to the BotsList request. The method always -// closes the http.Response Body. -func (c HealthbotsClient) responderForBotsList(resp *http.Response) (result BotsListOperationResponse, err error) { - type page struct { - Values []HealthBot `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result BotsListOperationResponse, err error) { - req, err := c.preparerForBotsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBotsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// BotsListComplete retrieves all of the results into a single object -func (c HealthbotsClient) BotsListComplete(ctx context.Context, id commonids.SubscriptionId) (BotsListCompleteResult, error) { - return c.BotsListCompleteMatchingPredicate(ctx, id, HealthBotOperationPredicate{}) -} - -// BotsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c HealthbotsClient) BotsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate HealthBotOperationPredicate) (resp BotsListCompleteResult, err error) { - items := make([]HealthBot, 0) - - page, err := c.BotsList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := BotsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup.go new file mode 100644 index 000000000000..44cb735000fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup.go @@ -0,0 +1,90 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]HealthBot +} + +type BotsListByResourceGroupCompleteResult struct { + Items []HealthBot +} + +// BotsListByResourceGroup ... +func (c HealthbotsClient) BotsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result BotsListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HealthBot/healthBots", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]HealthBot `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BotsListByResourceGroupComplete retrieves all the results into a single object +func (c HealthbotsClient) BotsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (BotsListByResourceGroupCompleteResult, error) { + return c.BotsListByResourceGroupCompleteMatchingPredicate(ctx, id, HealthBotOperationPredicate{}) +} + +// BotsListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c HealthbotsClient) BotsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate HealthBotOperationPredicate) (result BotsListByResourceGroupCompleteResult, err error) { + items := make([]HealthBot, 0) + + resp, err := c.BotsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = BotsListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup_autorest.go deleted file mode 100644 index 725250d3830e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]HealthBot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (BotsListByResourceGroupOperationResponse, error) -} - -type BotsListByResourceGroupCompleteResult struct { - Items []HealthBot -} - -func (r BotsListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r BotsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp BotsListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// BotsListByResourceGroup ... -func (c HealthbotsClient) BotsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp BotsListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForBotsListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForBotsListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForBotsListByResourceGroup prepares the BotsListByResourceGroup request. -func (c HealthbotsClient) preparerForBotsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HealthBot/healthBots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForBotsListByResourceGroupWithNextLink prepares the BotsListByResourceGroup request with the given nextLink token. -func (c HealthbotsClient) preparerForBotsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBotsListByResourceGroup handles the response to the BotsListByResourceGroup request. The method always -// closes the http.Response Body. -func (c HealthbotsClient) responderForBotsListByResourceGroup(resp *http.Response) (result BotsListByResourceGroupOperationResponse, err error) { - type page struct { - Values []HealthBot `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result BotsListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForBotsListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBotsListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// BotsListByResourceGroupComplete retrieves all of the results into a single object -func (c HealthbotsClient) BotsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (BotsListByResourceGroupCompleteResult, error) { - return c.BotsListByResourceGroupCompleteMatchingPredicate(ctx, id, HealthBotOperationPredicate{}) -} - -// BotsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c HealthbotsClient) BotsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate HealthBotOperationPredicate) (resp BotsListByResourceGroupCompleteResult, err error) { - items := make([]HealthBot, 0) - - page, err := c.BotsListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := BotsListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets.go new file mode 100644 index 000000000000..33be3545f6b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets.go @@ -0,0 +1,52 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HealthBotKeysResponse +} + +// BotsListSecrets ... +func (c HealthbotsClient) BotsListSecrets(ctx context.Context, id HealthBotId) (result BotsListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets_autorest.go deleted file mode 100644 index 36c8155ca17a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botslistsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *HealthBotKeysResponse -} - -// BotsListSecrets ... -func (c HealthbotsClient) BotsListSecrets(ctx context.Context, id HealthBotId) (result BotsListSecretsOperationResponse, err error) { - req, err := c.preparerForBotsListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBotsListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForBotsListSecrets prepares the BotsListSecrets request. -func (c HealthbotsClient) preparerForBotsListSecrets(ctx context.Context, id HealthBotId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBotsListSecrets handles the response to the BotsListSecrets request. The method always -// closes the http.Response Body. -func (c HealthbotsClient) responderForBotsListSecrets(resp *http.Response) (result BotsListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret.go new file mode 100644 index 000000000000..7304fa98ff72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret.go @@ -0,0 +1,52 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsRegenerateApiJwtSecretOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HealthBotKey +} + +// BotsRegenerateApiJwtSecret ... +func (c HealthbotsClient) BotsRegenerateApiJwtSecret(ctx context.Context, id HealthBotId) (result BotsRegenerateApiJwtSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateApiJwtSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret_autorest.go deleted file mode 100644 index f920b0db6c61..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsregenerateapijwtsecret_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsRegenerateApiJwtSecretOperationResponse struct { - HttpResponse *http.Response - Model *HealthBotKey -} - -// BotsRegenerateApiJwtSecret ... -func (c HealthbotsClient) BotsRegenerateApiJwtSecret(ctx context.Context, id HealthBotId) (result BotsRegenerateApiJwtSecretOperationResponse, err error) { - req, err := c.preparerForBotsRegenerateApiJwtSecret(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsRegenerateApiJwtSecret", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsRegenerateApiJwtSecret", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBotsRegenerateApiJwtSecret(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsRegenerateApiJwtSecret", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForBotsRegenerateApiJwtSecret prepares the BotsRegenerateApiJwtSecret request. -func (c HealthbotsClient) preparerForBotsRegenerateApiJwtSecret(ctx context.Context, id HealthBotId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateApiJwtSecret", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBotsRegenerateApiJwtSecret handles the response to the BotsRegenerateApiJwtSecret request. The method always -// closes the http.Response Body. -func (c HealthbotsClient) responderForBotsRegenerateApiJwtSecret(resp *http.Response) (result BotsRegenerateApiJwtSecretOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate.go new file mode 100644 index 000000000000..d330ad1a11fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate.go @@ -0,0 +1,74 @@ +package healthbots + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BotsUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BotsUpdate ... +func (c HealthbotsClient) BotsUpdate(ctx context.Context, id HealthBotId, input HealthBotUpdateParameters) (result BotsUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BotsUpdateThenPoll performs BotsUpdate then polls until it's completed +func (c HealthbotsClient) BotsUpdateThenPoll(ctx context.Context, id HealthBotId, input HealthBotUpdateParameters) error { + result, err := c.BotsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BotsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BotsUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate_autorest.go deleted file mode 100644 index 58fff79f3a35..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots/method_botsupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package healthbots - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BotsUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// BotsUpdate ... -func (c HealthbotsClient) BotsUpdate(ctx context.Context, id HealthBotId, input HealthBotUpdateParameters) (result BotsUpdateOperationResponse, err error) { - req, err := c.preparerForBotsUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForBotsUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "healthbots.HealthbotsClient", "BotsUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// BotsUpdateThenPoll performs BotsUpdate then polls until it's completed -func (c HealthbotsClient) BotsUpdateThenPoll(ctx context.Context, id HealthBotId, input HealthBotUpdateParameters) error { - result, err := c.BotsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing BotsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after BotsUpdate: %+v", err) - } - - return nil -} - -// preparerForBotsUpdate prepares the BotsUpdate request. -func (c HealthbotsClient) preparerForBotsUpdate(ctx context.Context, id HealthBotId, input HealthBotUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForBotsUpdate sends the BotsUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c HealthbotsClient) senderForBotsUpdate(ctx context.Context, req *http.Request) (future BotsUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/client.go index c75183a06370..a4336266a29d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/client.go @@ -1,18 +1,26 @@ package machineextensions -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type MachineExtensionsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewMachineExtensionsClientWithBaseURI(endpoint string) MachineExtensionsClient { - return MachineExtensionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewMachineExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*MachineExtensionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "machineextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MachineExtensionsClient: %+v", err) } + + return &MachineExtensionsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/constants.go index 7addbad5798d..13d3ae86a16a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/constants.go @@ -1,6 +1,10 @@ package machineextensions -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForStatusLevelTypes() []string { } } +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { vals := map[string]StatusLevelTypes{ "error": StatusLevelTypesError, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate.go new file mode 100644 index 000000000000..7828f1e590e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate.go @@ -0,0 +1,74 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c MachineExtensionsClient) CreateOrUpdate(ctx context.Context, id ExtensionId, input MachineExtension) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c MachineExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExtensionId, input MachineExtension) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate_autorest.go deleted file mode 100644 index bedfc9d4aaa7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package machineextensions - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c MachineExtensionsClient) CreateOrUpdate(ctx context.Context, id ExtensionId, input MachineExtension) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c MachineExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExtensionId, input MachineExtension) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c MachineExtensionsClient) preparerForCreateOrUpdate(ctx context.Context, id ExtensionId, input MachineExtension) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c MachineExtensionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete.go new file mode 100644 index 000000000000..c816a230864c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete.go @@ -0,0 +1,71 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c MachineExtensionsClient) Delete(ctx context.Context, id ExtensionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c MachineExtensionsClient) DeleteThenPoll(ctx context.Context, id ExtensionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete_autorest.go deleted file mode 100644 index 7eb2b1846855..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package machineextensions - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c MachineExtensionsClient) Delete(ctx context.Context, id ExtensionId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c MachineExtensionsClient) DeleteThenPoll(ctx context.Context, id ExtensionId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c MachineExtensionsClient) preparerForDelete(ctx context.Context, id ExtensionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c MachineExtensionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get.go new file mode 100644 index 000000000000..973b1f24d947 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get.go @@ -0,0 +1,51 @@ +package machineextensions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MachineExtension +} + +// Get ... +func (c MachineExtensionsClient) Get(ctx context.Context, id ExtensionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get_autorest.go deleted file mode 100644 index 8dc93ee55e10..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package machineextensions - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *MachineExtension -} - -// Get ... -func (c MachineExtensionsClient) Get(ctx context.Context, id ExtensionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c MachineExtensionsClient) preparerForGet(ctx context.Context, id ExtensionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c MachineExtensionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list.go new file mode 100644 index 000000000000..6064d95e69a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list.go @@ -0,0 +1,117 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]MachineExtension +} + +type ListCompleteResult struct { + Items []MachineExtension +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// List ... +func (c MachineExtensionsClient) List(ctx context.Context, id MachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/extensions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]MachineExtension `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c MachineExtensionsClient) ListComplete(ctx context.Context, id MachineId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, MachineExtensionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MachineExtensionsClient) ListCompleteMatchingPredicate(ctx context.Context, id MachineId, options ListOperationOptions, predicate MachineExtensionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]MachineExtension, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list_autorest.go deleted file mode 100644 index f53cea7a2ea3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_list_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package machineextensions - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]MachineExtension - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []MachineExtension -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Expand *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Expand != nil { - out["$expand"] = *o.Expand - } - - return out -} - -// List ... -func (c MachineExtensionsClient) List(ctx context.Context, id MachineId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c MachineExtensionsClient) preparerForList(ctx context.Context, id MachineId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/extensions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c MachineExtensionsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c MachineExtensionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []MachineExtension `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c MachineExtensionsClient) ListComplete(ctx context.Context, id MachineId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, MachineExtensionOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MachineExtensionsClient) ListCompleteMatchingPredicate(ctx context.Context, id MachineId, options ListOperationOptions, predicate MachineExtensionOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]MachineExtension, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update.go new file mode 100644 index 000000000000..60ce62f2eb27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update.go @@ -0,0 +1,74 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c MachineExtensionsClient) Update(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c MachineExtensionsClient) UpdateThenPoll(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update_autorest.go deleted file mode 100644 index 9e7279edd2ac..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package machineextensions - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c MachineExtensionsClient) Update(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c MachineExtensionsClient) UpdateThenPoll(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c MachineExtensionsClient) preparerForUpdate(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c MachineExtensionsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/client.go index 9ef1f74b8a52..e0daf9080614 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/client.go @@ -1,18 +1,26 @@ package machines -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type MachinesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewMachinesClientWithBaseURI(endpoint string) MachinesClient { - return MachinesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewMachinesClientWithBaseURI(sdkApi sdkEnv.Api) (*MachinesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "machines", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MachinesClient: %+v", err) } + + return &MachinesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/constants.go index d7a4fba194dd..60233929e76f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/constants.go @@ -1,6 +1,10 @@ package machines -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAgentConfigurationMode() []string { } } +func (s *AgentConfigurationMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentConfigurationMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentConfigurationMode(input string) (*AgentConfigurationMode, error) { vals := map[string]AgentConfigurationMode{ "full": AgentConfigurationModeFull, @@ -47,6 +64,19 @@ func PossibleValuesForAssessmentModeTypes() []string { } } +func (s *AssessmentModeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAssessmentModeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAssessmentModeTypes(input string) (*AssessmentModeTypes, error) { vals := map[string]AssessmentModeTypes{ "automaticbyplatform": AssessmentModeTypesAutomaticByPlatform, @@ -73,6 +103,19 @@ func PossibleValuesForInstanceViewTypes() []string { } } +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { vals := map[string]InstanceViewTypes{ "instanceview": InstanceViewTypesInstanceView, @@ -104,6 +147,19 @@ func PossibleValuesForPatchModeTypes() []string { } } +func (s *PatchModeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchModeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePatchModeTypes(input string) (*PatchModeTypes, error) { vals := map[string]PatchModeTypes{ "automaticbyos": PatchModeTypesAutomaticByOS, @@ -136,6 +192,19 @@ func PossibleValuesForStatusLevelTypes() []string { } } +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { vals := map[string]StatusLevelTypes{ "error": StatusLevelTypesError, @@ -167,6 +236,19 @@ func PossibleValuesForStatusTypes() []string { } } +func (s *StatusTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseStatusTypes(input string) (*StatusTypes, error) { vals := map[string]StatusTypes{ "connected": StatusTypesConnected, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate.go new file mode 100644 index 000000000000..bdab67a31d5d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate.go @@ -0,0 +1,55 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Machine +} + +// CreateOrUpdate ... +func (c MachinesClient) CreateOrUpdate(ctx context.Context, id MachineId, input Machine) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate_autorest.go deleted file mode 100644 index 65c8756bf30d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package machines - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Machine -} - -// CreateOrUpdate ... -func (c MachinesClient) CreateOrUpdate(ctx context.Context, id MachineId, input Machine) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c MachinesClient) preparerForCreateOrUpdate(ctx context.Context, id MachineId, input Machine) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c MachinesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete.go new file mode 100644 index 000000000000..60fb26d3e487 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete.go @@ -0,0 +1,47 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c MachinesClient) Delete(ctx context.Context, id MachineId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete_autorest.go deleted file mode 100644 index a68df6b858ef..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package machines - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c MachinesClient) Delete(ctx context.Context, id MachineId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c MachinesClient) preparerForDelete(ctx context.Context, id MachineId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c MachinesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get.go new file mode 100644 index 000000000000..f8ba0cd7f715 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get.go @@ -0,0 +1,80 @@ +package machines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Machine +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c MachinesClient) Get(ctx context.Context, id MachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get_autorest.go deleted file mode 100644 index 14056e65351e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_get_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package machines - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *Machine -} - -type GetOperationOptions struct { - Expand *InstanceViewTypes -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Expand != nil { - out["$expand"] = *o.Expand - } - - return out -} - -// Get ... -func (c MachinesClient) Get(ctx context.Context, id MachineId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c MachinesClient) preparerForGet(ctx context.Context, id MachineId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c MachinesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup.go new file mode 100644 index 000000000000..a64d13603ae2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package machines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Machine +} + +type ListByResourceGroupCompleteResult struct { + Items []Machine +} + +// ListByResourceGroup ... +func (c MachinesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridCompute/machines", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Machine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c MachinesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, MachineOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MachinesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate MachineOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Machine, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 4bb7051278c4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package machines - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]Machine - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Machine -} - -func (r ListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c MachinesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c MachinesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HybridCompute/machines", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c MachinesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c MachinesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Machine `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c MachinesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, MachineOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MachinesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate MachineOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Machine, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription.go new file mode 100644 index 000000000000..8bfb67f6afdc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription.go @@ -0,0 +1,90 @@ +package machines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Machine +} + +type ListBySubscriptionCompleteResult struct { + Items []Machine +} + +// ListBySubscription ... +func (c MachinesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridCompute/machines", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Machine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c MachinesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, MachineOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MachinesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate MachineOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Machine, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription_autorest.go deleted file mode 100644 index 4b626c9ea8ed..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package machines - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]Machine - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []Machine -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c MachinesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c MachinesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HybridCompute/machines", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c MachinesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c MachinesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []Machine `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c MachinesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, MachineOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MachinesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate MachineOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]Machine, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update.go new file mode 100644 index 000000000000..4d9bd64a961f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update.go @@ -0,0 +1,55 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Machine +} + +// Update ... +func (c MachinesClient) Update(ctx context.Context, id MachineId, input MachineUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update_autorest.go deleted file mode 100644 index 6181a4e8e4f0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package machines - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *Machine -} - -// Update ... -func (c MachinesClient) Update(ctx context.Context, id MachineId, input MachineUpdate) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c MachinesClient) preparerForUpdate(ctx context.Context, id MachineId, input MachineUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c MachinesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/client.go index 1de584406fe4..3bf7a6afe1ff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/client.go @@ -1,18 +1,26 @@ package privateendpointconnections -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PrivateEndpointConnectionsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "privateendpointconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) } + + return &PrivateEndpointConnectionsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate.go new file mode 100644 index 000000000000..ea82a91d47cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate.go @@ -0,0 +1,74 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate_autorest.go deleted file mode 100644 index 08aac1fbfa75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PrivateEndpointConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete.go new file mode 100644 index 000000000000..63c26e8f27f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete_autorest.go deleted file mode 100644 index ef4fd3d8e664..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get.go new file mode 100644 index 000000000000..6aeba2f77f92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get.go @@ -0,0 +1,51 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get_autorest.go deleted file mode 100644 index 44bbdcb8f0bf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// Get ... -func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope.go new file mode 100644 index 000000000000..bff2235d66c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope.go @@ -0,0 +1,89 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByPrivateLinkScopeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PrivateEndpointConnection +} + +type ListByPrivateLinkScopeCompleteResult struct { + Items []PrivateEndpointConnection +} + +// ListByPrivateLinkScope ... +func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, id ProviderPrivateLinkScopeId) (result ListByPrivateLinkScopeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateEndpointConnections", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PrivateEndpointConnection `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByPrivateLinkScopeComplete retrieves all the results into a single object +func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, id ProviderPrivateLinkScopeId) (ListByPrivateLinkScopeCompleteResult, error) { + return c.ListByPrivateLinkScopeCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByPrivateLinkScopeCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScopeCompleteMatchingPredicate(ctx context.Context, id ProviderPrivateLinkScopeId, predicate PrivateEndpointConnectionOperationPredicate) (result ListByPrivateLinkScopeCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + resp, err := c.ListByPrivateLinkScope(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByPrivateLinkScopeCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go deleted file mode 100644 index cf15facc9bcf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByPrivateLinkScopeOperationResponse struct { - HttpResponse *http.Response - Model *[]PrivateEndpointConnection - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByPrivateLinkScopeOperationResponse, error) -} - -type ListByPrivateLinkScopeCompleteResult struct { - Items []PrivateEndpointConnection -} - -func (r ListByPrivateLinkScopeOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByPrivateLinkScopeOperationResponse) LoadMore(ctx context.Context) (resp ListByPrivateLinkScopeOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByPrivateLinkScope ... -func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, id ProviderPrivateLinkScopeId) (resp ListByPrivateLinkScopeOperationResponse, err error) { - req, err := c.preparerForListByPrivateLinkScope(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByPrivateLinkScope(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByPrivateLinkScope prepares the ListByPrivateLinkScope request. -func (c PrivateEndpointConnectionsClient) preparerForListByPrivateLinkScope(ctx context.Context, id ProviderPrivateLinkScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByPrivateLinkScopeWithNextLink prepares the ListByPrivateLinkScope request with the given nextLink token. -func (c PrivateEndpointConnectionsClient) preparerForListByPrivateLinkScopeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByPrivateLinkScope handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForListByPrivateLinkScope(resp *http.Response) (result ListByPrivateLinkScopeOperationResponse, err error) { - type page struct { - Values []PrivateEndpointConnection `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByPrivateLinkScopeOperationResponse, err error) { - req, err := c.preparerForListByPrivateLinkScopeWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByPrivateLinkScope(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByPrivateLinkScopeComplete retrieves all of the results into a single object -func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, id ProviderPrivateLinkScopeId) (ListByPrivateLinkScopeCompleteResult, error) { - return c.ListByPrivateLinkScopeCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) -} - -// ListByPrivateLinkScopeCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScopeCompleteMatchingPredicate(ctx context.Context, id ProviderPrivateLinkScopeId, predicate PrivateEndpointConnectionOperationPredicate) (resp ListByPrivateLinkScopeCompleteResult, err error) { - items := make([]PrivateEndpointConnection, 0) - - page, err := c.ListByPrivateLinkScope(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByPrivateLinkScopeCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/client.go index 1adc41242b64..c1f8540450a3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/client.go @@ -1,18 +1,26 @@ package privatelinkscopes -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PrivateLinkScopesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPrivateLinkScopesClientWithBaseURI(endpoint string) PrivateLinkScopesClient { - return PrivateLinkScopesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPrivateLinkScopesClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkScopesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "privatelinkscopes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateLinkScopesClient: %+v", err) } + + return &PrivateLinkScopesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/constants.go index 9a54777bf8bb..89bd271900ef 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/constants.go @@ -1,6 +1,10 @@ package privatelinkscopes -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForPublicNetworkAccessType() []string { } } +func (s *PublicNetworkAccessType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccessType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccessType(input string) (*PublicNetworkAccessType, error) { vals := map[string]PublicNetworkAccessType{ "disabled": PublicNetworkAccessTypeDisabled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate.go new file mode 100644 index 000000000000..0ac5e8dd2363 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate.go @@ -0,0 +1,56 @@ +package privatelinkscopes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HybridComputePrivateLinkScope +} + +// PrivateLinkScopesCreateOrUpdate ... +func (c PrivateLinkScopesClient) PrivateLinkScopesCreateOrUpdate(ctx context.Context, id ProviderPrivateLinkScopeId, input HybridComputePrivateLinkScope) (result PrivateLinkScopesCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate_autorest.go deleted file mode 100644 index 8b8af7214835..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopescreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *HybridComputePrivateLinkScope -} - -// PrivateLinkScopesCreateOrUpdate ... -func (c PrivateLinkScopesClient) PrivateLinkScopesCreateOrUpdate(ctx context.Context, id ProviderPrivateLinkScopeId, input HybridComputePrivateLinkScope) (result PrivateLinkScopesCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkScopesCreateOrUpdate prepares the PrivateLinkScopesCreateOrUpdate request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesCreateOrUpdate(ctx context.Context, id ProviderPrivateLinkScopeId, input HybridComputePrivateLinkScope) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesCreateOrUpdate handles the response to the PrivateLinkScopesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesCreateOrUpdate(resp *http.Response) (result PrivateLinkScopesCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete.go new file mode 100644 index 000000000000..1373f46c4484 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete.go @@ -0,0 +1,71 @@ +package privatelinkscopes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PrivateLinkScopesDelete ... +func (c PrivateLinkScopesClient) PrivateLinkScopesDelete(ctx context.Context, id ProviderPrivateLinkScopeId) (result PrivateLinkScopesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PrivateLinkScopesDeleteThenPoll performs PrivateLinkScopesDelete then polls until it's completed +func (c PrivateLinkScopesClient) PrivateLinkScopesDeleteThenPoll(ctx context.Context, id ProviderPrivateLinkScopeId) error { + result, err := c.PrivateLinkScopesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PrivateLinkScopesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateLinkScopesDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete_autorest.go deleted file mode 100644 index 76b7411aa3a8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesdelete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// PrivateLinkScopesDelete ... -func (c PrivateLinkScopesClient) PrivateLinkScopesDelete(ctx context.Context, id ProviderPrivateLinkScopeId) (result PrivateLinkScopesDeleteOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForPrivateLinkScopesDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PrivateLinkScopesDeleteThenPoll performs PrivateLinkScopesDelete then polls until it's completed -func (c PrivateLinkScopesClient) PrivateLinkScopesDeleteThenPoll(ctx context.Context, id ProviderPrivateLinkScopeId) error { - result, err := c.PrivateLinkScopesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PrivateLinkScopesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after PrivateLinkScopesDelete: %+v", err) - } - - return nil -} - -// preparerForPrivateLinkScopesDelete prepares the PrivateLinkScopesDelete request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesDelete(ctx context.Context, id ProviderPrivateLinkScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPrivateLinkScopesDelete sends the PrivateLinkScopesDelete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateLinkScopesClient) senderForPrivateLinkScopesDelete(ctx context.Context, req *http.Request) (future PrivateLinkScopesDeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget.go new file mode 100644 index 000000000000..ef8815df2730 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget.go @@ -0,0 +1,51 @@ +package privatelinkscopes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HybridComputePrivateLinkScope +} + +// PrivateLinkScopesGet ... +func (c PrivateLinkScopesClient) PrivateLinkScopesGet(ctx context.Context, id ProviderPrivateLinkScopeId) (result PrivateLinkScopesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget_autorest.go deleted file mode 100644 index ae231a0b19e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesGetOperationResponse struct { - HttpResponse *http.Response - Model *HybridComputePrivateLinkScope -} - -// PrivateLinkScopesGet ... -func (c PrivateLinkScopesClient) PrivateLinkScopesGet(ctx context.Context, id ProviderPrivateLinkScopeId) (result PrivateLinkScopesGetOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkScopesGet prepares the PrivateLinkScopesGet request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesGet(ctx context.Context, id ProviderPrivateLinkScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesGet handles the response to the PrivateLinkScopesGet request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesGet(resp *http.Response) (result PrivateLinkScopesGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails.go new file mode 100644 index 000000000000..33e15c3275ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails.go @@ -0,0 +1,51 @@ +package privatelinkscopes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesGetValidationDetailsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkScopeValidationDetails +} + +// PrivateLinkScopesGetValidationDetails ... +func (c PrivateLinkScopesClient) PrivateLinkScopesGetValidationDetails(ctx context.Context, id PrivateLinkScopeId) (result PrivateLinkScopesGetValidationDetailsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails_autorest.go deleted file mode 100644 index 52772a9f46f4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetails_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesGetValidationDetailsOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkScopeValidationDetails -} - -// PrivateLinkScopesGetValidationDetails ... -func (c PrivateLinkScopesClient) PrivateLinkScopesGetValidationDetails(ctx context.Context, id PrivateLinkScopeId) (result PrivateLinkScopesGetValidationDetailsOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesGetValidationDetails(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGetValidationDetails", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGetValidationDetails", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesGetValidationDetails(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGetValidationDetails", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkScopesGetValidationDetails prepares the PrivateLinkScopesGetValidationDetails request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesGetValidationDetails(ctx context.Context, id PrivateLinkScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesGetValidationDetails handles the response to the PrivateLinkScopesGetValidationDetails request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesGetValidationDetails(resp *http.Response) (result PrivateLinkScopesGetValidationDetailsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine.go new file mode 100644 index 000000000000..1d30371bbf25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine.go @@ -0,0 +1,52 @@ +package privatelinkscopes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesGetValidationDetailsForMachineOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkScopeValidationDetails +} + +// PrivateLinkScopesGetValidationDetailsForMachine ... +func (c PrivateLinkScopesClient) PrivateLinkScopesGetValidationDetailsForMachine(ctx context.Context, id MachineId) (result PrivateLinkScopesGetValidationDetailsForMachineOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateLinkScopes/current", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine_autorest.go deleted file mode 100644 index 5463290c88df..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesgetvalidationdetailsformachine_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesGetValidationDetailsForMachineOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkScopeValidationDetails -} - -// PrivateLinkScopesGetValidationDetailsForMachine ... -func (c PrivateLinkScopesClient) PrivateLinkScopesGetValidationDetailsForMachine(ctx context.Context, id MachineId) (result PrivateLinkScopesGetValidationDetailsForMachineOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesGetValidationDetailsForMachine(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGetValidationDetailsForMachine", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGetValidationDetailsForMachine", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesGetValidationDetailsForMachine(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesGetValidationDetailsForMachine", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkScopesGetValidationDetailsForMachine prepares the PrivateLinkScopesGetValidationDetailsForMachine request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesGetValidationDetailsForMachine(ctx context.Context, id MachineId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateLinkScopes/current", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesGetValidationDetailsForMachine handles the response to the PrivateLinkScopesGetValidationDetailsForMachine request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesGetValidationDetailsForMachine(resp *http.Response) (result PrivateLinkScopesGetValidationDetailsForMachineOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist.go new file mode 100644 index 000000000000..299088d7b868 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist.go @@ -0,0 +1,90 @@ +package privatelinkscopes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]HybridComputePrivateLinkScope +} + +type PrivateLinkScopesListCompleteResult struct { + Items []HybridComputePrivateLinkScope +} + +// PrivateLinkScopesList ... +func (c PrivateLinkScopesClient) PrivateLinkScopesList(ctx context.Context, id commonids.SubscriptionId) (result PrivateLinkScopesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridCompute/privateLinkScopes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]HybridComputePrivateLinkScope `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// PrivateLinkScopesListComplete retrieves all the results into a single object +func (c PrivateLinkScopesClient) PrivateLinkScopesListComplete(ctx context.Context, id commonids.SubscriptionId) (PrivateLinkScopesListCompleteResult, error) { + return c.PrivateLinkScopesListCompleteMatchingPredicate(ctx, id, HybridComputePrivateLinkScopeOperationPredicate{}) +} + +// PrivateLinkScopesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateLinkScopesClient) PrivateLinkScopesListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate HybridComputePrivateLinkScopeOperationPredicate) (result PrivateLinkScopesListCompleteResult, err error) { + items := make([]HybridComputePrivateLinkScope, 0) + + resp, err := c.PrivateLinkScopesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = PrivateLinkScopesListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist_autorest.go deleted file mode 100644 index 413001929af2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesListOperationResponse struct { - HttpResponse *http.Response - Model *[]HybridComputePrivateLinkScope - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (PrivateLinkScopesListOperationResponse, error) -} - -type PrivateLinkScopesListCompleteResult struct { - Items []HybridComputePrivateLinkScope -} - -func (r PrivateLinkScopesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r PrivateLinkScopesListOperationResponse) LoadMore(ctx context.Context) (resp PrivateLinkScopesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// PrivateLinkScopesList ... -func (c PrivateLinkScopesClient) PrivateLinkScopesList(ctx context.Context, id commonids.SubscriptionId) (resp PrivateLinkScopesListOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForPrivateLinkScopesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForPrivateLinkScopesList prepares the PrivateLinkScopesList request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HybridCompute/privateLinkScopes", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForPrivateLinkScopesListWithNextLink prepares the PrivateLinkScopesList request with the given nextLink token. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesList handles the response to the PrivateLinkScopesList request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesList(resp *http.Response) (result PrivateLinkScopesListOperationResponse, err error) { - type page struct { - Values []HybridComputePrivateLinkScope `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result PrivateLinkScopesListOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// PrivateLinkScopesListComplete retrieves all of the results into a single object -func (c PrivateLinkScopesClient) PrivateLinkScopesListComplete(ctx context.Context, id commonids.SubscriptionId) (PrivateLinkScopesListCompleteResult, error) { - return c.PrivateLinkScopesListCompleteMatchingPredicate(ctx, id, HybridComputePrivateLinkScopeOperationPredicate{}) -} - -// PrivateLinkScopesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateLinkScopesClient) PrivateLinkScopesListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate HybridComputePrivateLinkScopeOperationPredicate) (resp PrivateLinkScopesListCompleteResult, err error) { - items := make([]HybridComputePrivateLinkScope, 0) - - page, err := c.PrivateLinkScopesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := PrivateLinkScopesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup.go new file mode 100644 index 000000000000..26fa7a8d9f22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup.go @@ -0,0 +1,90 @@ +package privatelinkscopes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]HybridComputePrivateLinkScope +} + +type PrivateLinkScopesListByResourceGroupCompleteResult struct { + Items []HybridComputePrivateLinkScope +} + +// PrivateLinkScopesListByResourceGroup ... +func (c PrivateLinkScopesClient) PrivateLinkScopesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result PrivateLinkScopesListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.HybridCompute/privateLinkScopes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]HybridComputePrivateLinkScope `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// PrivateLinkScopesListByResourceGroupComplete retrieves all the results into a single object +func (c PrivateLinkScopesClient) PrivateLinkScopesListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (PrivateLinkScopesListByResourceGroupCompleteResult, error) { + return c.PrivateLinkScopesListByResourceGroupCompleteMatchingPredicate(ctx, id, HybridComputePrivateLinkScopeOperationPredicate{}) +} + +// PrivateLinkScopesListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateLinkScopesClient) PrivateLinkScopesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate HybridComputePrivateLinkScopeOperationPredicate) (result PrivateLinkScopesListByResourceGroupCompleteResult, err error) { + items := make([]HybridComputePrivateLinkScope, 0) + + resp, err := c.PrivateLinkScopesListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = PrivateLinkScopesListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup_autorest.go deleted file mode 100644 index 7acd437cf7e5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopeslistbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]HybridComputePrivateLinkScope - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (PrivateLinkScopesListByResourceGroupOperationResponse, error) -} - -type PrivateLinkScopesListByResourceGroupCompleteResult struct { - Items []HybridComputePrivateLinkScope -} - -func (r PrivateLinkScopesListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r PrivateLinkScopesListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp PrivateLinkScopesListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// PrivateLinkScopesListByResourceGroup ... -func (c PrivateLinkScopesClient) PrivateLinkScopesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp PrivateLinkScopesListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForPrivateLinkScopesListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForPrivateLinkScopesListByResourceGroup prepares the PrivateLinkScopesListByResourceGroup request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HybridCompute/privateLinkScopes", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForPrivateLinkScopesListByResourceGroupWithNextLink prepares the PrivateLinkScopesListByResourceGroup request with the given nextLink token. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesListByResourceGroup handles the response to the PrivateLinkScopesListByResourceGroup request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesListByResourceGroup(resp *http.Response) (result PrivateLinkScopesListByResourceGroupOperationResponse, err error) { - type page struct { - Values []HybridComputePrivateLinkScope `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result PrivateLinkScopesListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// PrivateLinkScopesListByResourceGroupComplete retrieves all of the results into a single object -func (c PrivateLinkScopesClient) PrivateLinkScopesListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (PrivateLinkScopesListByResourceGroupCompleteResult, error) { - return c.PrivateLinkScopesListByResourceGroupCompleteMatchingPredicate(ctx, id, HybridComputePrivateLinkScopeOperationPredicate{}) -} - -// PrivateLinkScopesListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateLinkScopesClient) PrivateLinkScopesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate HybridComputePrivateLinkScopeOperationPredicate) (resp PrivateLinkScopesListByResourceGroupCompleteResult, err error) { - items := make([]HybridComputePrivateLinkScope, 0) - - page, err := c.PrivateLinkScopesListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := PrivateLinkScopesListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags.go new file mode 100644 index 000000000000..67442337c2b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags.go @@ -0,0 +1,55 @@ +package privatelinkscopes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopesUpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *HybridComputePrivateLinkScope +} + +// PrivateLinkScopesUpdateTags ... +func (c PrivateLinkScopesClient) PrivateLinkScopesUpdateTags(ctx context.Context, id ProviderPrivateLinkScopeId, input TagsResource) (result PrivateLinkScopesUpdateTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags_autorest.go deleted file mode 100644 index 00f6f3f83765..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/method_privatelinkscopesupdatetags_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privatelinkscopes - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkScopesUpdateTagsOperationResponse struct { - HttpResponse *http.Response - Model *HybridComputePrivateLinkScope -} - -// PrivateLinkScopesUpdateTags ... -func (c PrivateLinkScopesClient) PrivateLinkScopesUpdateTags(ctx context.Context, id ProviderPrivateLinkScopeId, input TagsResource) (result PrivateLinkScopesUpdateTagsOperationResponse, err error) { - req, err := c.preparerForPrivateLinkScopesUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesUpdateTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesUpdateTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkScopesUpdateTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkscopes.PrivateLinkScopesClient", "PrivateLinkScopesUpdateTags", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkScopesUpdateTags prepares the PrivateLinkScopesUpdateTags request. -func (c PrivateLinkScopesClient) preparerForPrivateLinkScopesUpdateTags(ctx context.Context, id ProviderPrivateLinkScopeId, input TagsResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkScopesUpdateTags handles the response to the PrivateLinkScopesUpdateTags request. The method always -// closes the http.Response Body. -func (c PrivateLinkScopesClient) responderForPrivateLinkScopesUpdateTags(resp *http.Response) (result PrivateLinkScopesUpdateTagsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/client.go index 8927fd807b8f..c25ebd209c77 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/client.go @@ -1,18 +1,26 @@ package connectedclusters -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ConnectedClustersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewConnectedClustersClientWithBaseURI(endpoint string) ConnectedClustersClient { - return ConnectedClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewConnectedClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*ConnectedClustersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "connectedclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ConnectedClustersClient: %+v", err) } + + return &ConnectedClustersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/constants.go index dbe53c5b621b..2cd96141a25a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/constants.go @@ -1,6 +1,10 @@ package connectedclusters -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAuthenticationMethod() []string { } } +func (s *AuthenticationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthenticationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAuthenticationMethod(input string) (*AuthenticationMethod, error) { vals := map[string]AuthenticationMethod{ "aad": AuthenticationMethodAAD, @@ -51,6 +68,19 @@ func PossibleValuesForConnectivityStatus() []string { } } +func (s *ConnectivityStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectivityStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectivityStatus(input string) (*ConnectivityStatus, error) { vals := map[string]ConnectivityStatus{ "connected": ConnectivityStatusConnected, @@ -91,6 +121,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "accepted": ProvisioningStateAccepted, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate.go new file mode 100644 index 000000000000..09ae5e4d585c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate.go @@ -0,0 +1,74 @@ +package connectedclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterCreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConnectedClusterCreate ... +func (c ConnectedClustersClient) ConnectedClusterCreate(ctx context.Context, id ConnectedClusterId, input ConnectedCluster) (result ConnectedClusterCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ConnectedClusterCreateThenPoll performs ConnectedClusterCreate then polls until it's completed +func (c ConnectedClustersClient) ConnectedClusterCreateThenPoll(ctx context.Context, id ConnectedClusterId, input ConnectedCluster) error { + result, err := c.ConnectedClusterCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConnectedClusterCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConnectedClusterCreate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate_autorest.go deleted file mode 100644 index 46ed03fa0a75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclustercreate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package connectedclusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterCreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ConnectedClusterCreate ... -func (c ConnectedClustersClient) ConnectedClusterCreate(ctx context.Context, id ConnectedClusterId, input ConnectedCluster) (result ConnectedClusterCreateOperationResponse, err error) { - req, err := c.preparerForConnectedClusterCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterCreate", nil, "Failure preparing request") - return - } - - result, err = c.senderForConnectedClusterCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterCreate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ConnectedClusterCreateThenPoll performs ConnectedClusterCreate then polls until it's completed -func (c ConnectedClustersClient) ConnectedClusterCreateThenPoll(ctx context.Context, id ConnectedClusterId, input ConnectedCluster) error { - result, err := c.ConnectedClusterCreate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ConnectedClusterCreate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ConnectedClusterCreate: %+v", err) - } - - return nil -} - -// preparerForConnectedClusterCreate prepares the ConnectedClusterCreate request. -func (c ConnectedClustersClient) preparerForConnectedClusterCreate(ctx context.Context, id ConnectedClusterId, input ConnectedCluster) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForConnectedClusterCreate sends the ConnectedClusterCreate request. The method will close the -// http.Response Body if it receives an error. -func (c ConnectedClustersClient) senderForConnectedClusterCreate(ctx context.Context, req *http.Request) (future ConnectedClusterCreateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete.go new file mode 100644 index 000000000000..26ad549db1b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete.go @@ -0,0 +1,71 @@ +package connectedclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConnectedClusterDelete ... +func (c ConnectedClustersClient) ConnectedClusterDelete(ctx context.Context, id ConnectedClusterId) (result ConnectedClusterDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ConnectedClusterDeleteThenPoll performs ConnectedClusterDelete then polls until it's completed +func (c ConnectedClustersClient) ConnectedClusterDeleteThenPoll(ctx context.Context, id ConnectedClusterId) error { + result, err := c.ConnectedClusterDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ConnectedClusterDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConnectedClusterDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete_autorest.go deleted file mode 100644 index 3c075e92fb78..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterdelete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package connectedclusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ConnectedClusterDelete ... -func (c ConnectedClustersClient) ConnectedClusterDelete(ctx context.Context, id ConnectedClusterId) (result ConnectedClusterDeleteOperationResponse, err error) { - req, err := c.preparerForConnectedClusterDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForConnectedClusterDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ConnectedClusterDeleteThenPoll performs ConnectedClusterDelete then polls until it's completed -func (c ConnectedClustersClient) ConnectedClusterDeleteThenPoll(ctx context.Context, id ConnectedClusterId) error { - result, err := c.ConnectedClusterDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing ConnectedClusterDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ConnectedClusterDelete: %+v", err) - } - - return nil -} - -// preparerForConnectedClusterDelete prepares the ConnectedClusterDelete request. -func (c ConnectedClustersClient) preparerForConnectedClusterDelete(ctx context.Context, id ConnectedClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForConnectedClusterDelete sends the ConnectedClusterDelete request. The method will close the -// http.Response Body if it receives an error. -func (c ConnectedClustersClient) senderForConnectedClusterDelete(ctx context.Context, req *http.Request) (future ConnectedClusterDeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget.go new file mode 100644 index 000000000000..0ea52a6edddd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget.go @@ -0,0 +1,51 @@ +package connectedclusters + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConnectedCluster +} + +// ConnectedClusterGet ... +func (c ConnectedClustersClient) ConnectedClusterGet(ctx context.Context, id ConnectedClusterId) (result ConnectedClusterGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget_autorest.go deleted file mode 100644 index b5150631856c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package connectedclusters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterGetOperationResponse struct { - HttpResponse *http.Response - Model *ConnectedCluster -} - -// ConnectedClusterGet ... -func (c ConnectedClustersClient) ConnectedClusterGet(ctx context.Context, id ConnectedClusterId) (result ConnectedClusterGetOperationResponse, err error) { - req, err := c.preparerForConnectedClusterGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForConnectedClusterGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForConnectedClusterGet prepares the ConnectedClusterGet request. -func (c ConnectedClustersClient) preparerForConnectedClusterGet(ctx context.Context, id ConnectedClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForConnectedClusterGet handles the response to the ConnectedClusterGet request. The method always -// closes the http.Response Body. -func (c ConnectedClustersClient) responderForConnectedClusterGet(resp *http.Response) (result ConnectedClusterGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup.go new file mode 100644 index 000000000000..2304bcbbeac3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup.go @@ -0,0 +1,90 @@ +package connectedclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ConnectedCluster +} + +type ConnectedClusterListByResourceGroupCompleteResult struct { + Items []ConnectedCluster +} + +// ConnectedClusterListByResourceGroup ... +func (c ConnectedClustersClient) ConnectedClusterListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ConnectedClusterListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Kubernetes/connectedClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ConnectedCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ConnectedClusterListByResourceGroupComplete retrieves all the results into a single object +func (c ConnectedClustersClient) ConnectedClusterListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ConnectedClusterListByResourceGroupCompleteResult, error) { + return c.ConnectedClusterListByResourceGroupCompleteMatchingPredicate(ctx, id, ConnectedClusterOperationPredicate{}) +} + +// ConnectedClusterListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ConnectedClustersClient) ConnectedClusterListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ConnectedClusterOperationPredicate) (result ConnectedClusterListByResourceGroupCompleteResult, err error) { + items := make([]ConnectedCluster, 0) + + resp, err := c.ConnectedClusterListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ConnectedClusterListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup_autorest.go deleted file mode 100644 index ff6e9cc79d71..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package connectedclusters - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]ConnectedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ConnectedClusterListByResourceGroupOperationResponse, error) -} - -type ConnectedClusterListByResourceGroupCompleteResult struct { - Items []ConnectedCluster -} - -func (r ConnectedClusterListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ConnectedClusterListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ConnectedClusterListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ConnectedClusterListByResourceGroup ... -func (c ConnectedClustersClient) ConnectedClusterListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ConnectedClusterListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForConnectedClusterListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForConnectedClusterListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForConnectedClusterListByResourceGroup prepares the ConnectedClusterListByResourceGroup request. -func (c ConnectedClustersClient) preparerForConnectedClusterListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Kubernetes/connectedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForConnectedClusterListByResourceGroupWithNextLink prepares the ConnectedClusterListByResourceGroup request with the given nextLink token. -func (c ConnectedClustersClient) preparerForConnectedClusterListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForConnectedClusterListByResourceGroup handles the response to the ConnectedClusterListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ConnectedClustersClient) responderForConnectedClusterListByResourceGroup(resp *http.Response) (result ConnectedClusterListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ConnectedCluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ConnectedClusterListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForConnectedClusterListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForConnectedClusterListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ConnectedClusterListByResourceGroupComplete retrieves all of the results into a single object -func (c ConnectedClustersClient) ConnectedClusterListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ConnectedClusterListByResourceGroupCompleteResult, error) { - return c.ConnectedClusterListByResourceGroupCompleteMatchingPredicate(ctx, id, ConnectedClusterOperationPredicate{}) -} - -// ConnectedClusterListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConnectedClustersClient) ConnectedClusterListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ConnectedClusterOperationPredicate) (resp ConnectedClusterListByResourceGroupCompleteResult, err error) { - items := make([]ConnectedCluster, 0) - - page, err := c.ConnectedClusterListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ConnectedClusterListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription.go new file mode 100644 index 000000000000..8f3abc456649 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription.go @@ -0,0 +1,90 @@ +package connectedclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ConnectedCluster +} + +type ConnectedClusterListBySubscriptionCompleteResult struct { + Items []ConnectedCluster +} + +// ConnectedClusterListBySubscription ... +func (c ConnectedClustersClient) ConnectedClusterListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ConnectedClusterListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Kubernetes/connectedClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ConnectedCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ConnectedClusterListBySubscriptionComplete retrieves all the results into a single object +func (c ConnectedClustersClient) ConnectedClusterListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ConnectedClusterListBySubscriptionCompleteResult, error) { + return c.ConnectedClusterListBySubscriptionCompleteMatchingPredicate(ctx, id, ConnectedClusterOperationPredicate{}) +} + +// ConnectedClusterListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ConnectedClustersClient) ConnectedClusterListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ConnectedClusterOperationPredicate) (result ConnectedClusterListBySubscriptionCompleteResult, err error) { + items := make([]ConnectedCluster, 0) + + resp, err := c.ConnectedClusterListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ConnectedClusterListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription_autorest.go deleted file mode 100644 index 52786074e08d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package connectedclusters - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]ConnectedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ConnectedClusterListBySubscriptionOperationResponse, error) -} - -type ConnectedClusterListBySubscriptionCompleteResult struct { - Items []ConnectedCluster -} - -func (r ConnectedClusterListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ConnectedClusterListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ConnectedClusterListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ConnectedClusterListBySubscription ... -func (c ConnectedClustersClient) ConnectedClusterListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ConnectedClusterListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForConnectedClusterListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForConnectedClusterListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForConnectedClusterListBySubscription prepares the ConnectedClusterListBySubscription request. -func (c ConnectedClustersClient) preparerForConnectedClusterListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Kubernetes/connectedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForConnectedClusterListBySubscriptionWithNextLink prepares the ConnectedClusterListBySubscription request with the given nextLink token. -func (c ConnectedClustersClient) preparerForConnectedClusterListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForConnectedClusterListBySubscription handles the response to the ConnectedClusterListBySubscription request. The method always -// closes the http.Response Body. -func (c ConnectedClustersClient) responderForConnectedClusterListBySubscription(resp *http.Response) (result ConnectedClusterListBySubscriptionOperationResponse, err error) { - type page struct { - Values []ConnectedCluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ConnectedClusterListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForConnectedClusterListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForConnectedClusterListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ConnectedClusterListBySubscriptionComplete retrieves all of the results into a single object -func (c ConnectedClustersClient) ConnectedClusterListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ConnectedClusterListBySubscriptionCompleteResult, error) { - return c.ConnectedClusterListBySubscriptionCompleteMatchingPredicate(ctx, id, ConnectedClusterOperationPredicate{}) -} - -// ConnectedClusterListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConnectedClustersClient) ConnectedClusterListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ConnectedClusterOperationPredicate) (resp ConnectedClusterListBySubscriptionCompleteResult, err error) { - items := make([]ConnectedCluster, 0) - - page, err := c.ConnectedClusterListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ConnectedClusterListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential.go new file mode 100644 index 000000000000..49153e1816ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential.go @@ -0,0 +1,56 @@ +package connectedclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterListClusterUserCredentialOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +// ConnectedClusterListClusterUserCredential ... +func (c ConnectedClustersClient) ConnectedClusterListClusterUserCredential(ctx context.Context, id ConnectedClusterId, input ListClusterUserCredentialProperties) (result ConnectedClusterListClusterUserCredentialOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterUserCredential", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential_autorest.go deleted file mode 100644 index ae613bee39f9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterlistclusterusercredential_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package connectedclusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterListClusterUserCredentialOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -// ConnectedClusterListClusterUserCredential ... -func (c ConnectedClustersClient) ConnectedClusterListClusterUserCredential(ctx context.Context, id ConnectedClusterId, input ListClusterUserCredentialProperties) (result ConnectedClusterListClusterUserCredentialOperationResponse, err error) { - req, err := c.preparerForConnectedClusterListClusterUserCredential(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListClusterUserCredential", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListClusterUserCredential", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForConnectedClusterListClusterUserCredential(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterListClusterUserCredential", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForConnectedClusterListClusterUserCredential prepares the ConnectedClusterListClusterUserCredential request. -func (c ConnectedClustersClient) preparerForConnectedClusterListClusterUserCredential(ctx context.Context, id ConnectedClusterId, input ListClusterUserCredentialProperties) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listClusterUserCredential", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForConnectedClusterListClusterUserCredential handles the response to the ConnectedClusterListClusterUserCredential request. The method always -// closes the http.Response Body. -func (c ConnectedClustersClient) responderForConnectedClusterListClusterUserCredential(resp *http.Response) (result ConnectedClusterListClusterUserCredentialOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate.go new file mode 100644 index 000000000000..56b6b85664cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate.go @@ -0,0 +1,55 @@ +package connectedclusters + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectedClusterUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConnectedCluster +} + +// ConnectedClusterUpdate ... +func (c ConnectedClustersClient) ConnectedClusterUpdate(ctx context.Context, id ConnectedClusterId, input ConnectedClusterPatch) (result ConnectedClusterUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate_autorest.go deleted file mode 100644 index d12988702916..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/method_connectedclusterupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package connectedclusters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConnectedClusterUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ConnectedCluster -} - -// ConnectedClusterUpdate ... -func (c ConnectedClustersClient) ConnectedClusterUpdate(ctx context.Context, id ConnectedClusterId, input ConnectedClusterPatch) (result ConnectedClusterUpdateOperationResponse, err error) { - req, err := c.preparerForConnectedClusterUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForConnectedClusterUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connectedclusters.ConnectedClustersClient", "ConnectedClusterUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForConnectedClusterUpdate prepares the ConnectedClusterUpdate request. -func (c ConnectedClustersClient) preparerForConnectedClusterUpdate(ctx context.Context, id ConnectedClusterId, input ConnectedClusterPatch) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForConnectedClusterUpdate handles the response to the ConnectedClusterUpdate request. The method always -// closes the http.Response Body. -func (c ConnectedClustersClient) responderForConnectedClusterUpdate(resp *http.Response) (result ConnectedClusterUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go index 66d04205caa2..e97471b9cdae 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go @@ -40,13 +40,13 @@ func PollerFromResponse(response *client.Response, client *Client) (poller polle contentType = response.Request.Header.Get("Content-Type") } - statusCodesToCheckProvisioningState := response.StatusCode == http.StatusOK || response.StatusCode == http.StatusCreated + statusCodesToCheckProvisioningState := response.StatusCode == http.StatusOK || response.StatusCode == http.StatusCreated || (response.StatusCode == http.StatusAccepted && lroIsSelfReference) contentTypeMatchesForProvisioningStateCheck := strings.Contains(strings.ToLower(contentType), "application/json") methodIsApplicable := strings.EqualFold(response.Request.Method, "PATCH") || strings.EqualFold(response.Request.Method, "POST") || strings.EqualFold(response.Request.Method, "PUT") if statusCodesToCheckProvisioningState && contentTypeMatchesForProvisioningStateCheck && methodIsApplicable { - provisioningState, provisioningStateErr := provisioningStatePollerFromResponse(response, client, DefaultPollingInterval) + provisioningState, provisioningStateErr := provisioningStatePollerFromResponse(response, lroIsSelfReference, client, DefaultPollingInterval) if provisioningStateErr != nil { err = provisioningStateErr return pollers.Poller{}, fmt.Errorf("building provisioningState poller: %+v", provisioningStateErr) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go index e3b820d3e77c..d79f9b89621e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go @@ -174,9 +174,10 @@ func (p *longRunningOperationPoller) Poll(ctx context.Context) (result *pollers. "Updating": pollers.PollingStatusInProgress, // StorageSync@2020-03-01 returns `validateInput`, `newPrivateDnsEntries`, `finishNewStorageSyncService` rather than `InProgress` during creation/update // See: https://github.com/hashicorp/go-azure-sdk/issues/565 - "validateInput": pollers.PollingStatusInProgress, - "newPrivateDnsEntries": pollers.PollingStatusInProgress, - "finishNewStorageSyncService": pollers.PollingStatusInProgress, + "validateInput": pollers.PollingStatusInProgress, + "newPrivateDnsEntries": pollers.PollingStatusInProgress, + "newManagedIdentityCredentialStep": pollers.PollingStatusInProgress, + "finishNewStorageSyncService": pollers.PollingStatusInProgress, // StorageSync@2020-03-01 (CloudEndpoints) returns `newReplicaGroup` rather than `InProgress` during creation/update // See: https://github.com/hashicorp/go-azure-sdk/issues/565 "newReplicaGroup": pollers.PollingStatusInProgress, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go index 36c14507af73..0805d872b613 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go @@ -29,17 +29,17 @@ type provisioningStatePoller struct { resourcePath string } -func provisioningStatePollerFromResponse(response *client.Response, client *Client, pollingInterval time.Duration) (*provisioningStatePoller, error) { +func provisioningStatePollerFromResponse(response *client.Response, lroIsSelfReference bool, client *Client, pollingInterval time.Duration) (*provisioningStatePoller, error) { // if we've gotten to this point then we're polling against a Resource Manager resource/operation of some kind // we next need to determine if the current URI is a Resource Manager resource, or if we should be polling on the // resource (e.g. `/my/resource`) rather than an operation on the resource (e.g. `/my/resource/start`) if response.Request == nil { return nil, fmt.Errorf("request was nil") } - originalUri := response.Request.URL.RequestURI() if response.Request.URL == nil { return nil, fmt.Errorf("request url was nil") } + originalUri := response.Request.URL.RequestURI() // all Resource Manager operations require the `api-version` querystring apiVersion := response.Request.URL.Query().Get("api-version") @@ -47,9 +47,14 @@ func provisioningStatePollerFromResponse(response *client.Response, client *Clie return nil, fmt.Errorf("unable to determine `api-version` from %q", originalUri) } - resourcePath, err := resourceManagerResourcePathFromUri(originalUri) - if err != nil { - return nil, fmt.Errorf("determining Resource Manager Resource Path from %q: %+v", originalUri, err) + resourcePath := originalUri + if !lroIsSelfReference { + // if it's a self-reference (such as API Management's API/API Schema) + path, err := resourceManagerResourcePathFromUri(originalUri) + if err != nil { + return nil, fmt.Errorf("determining Resource Manager Resource Path from %q: %+v", originalUri, err) + } + resourcePath = *path } return &provisioningStatePoller{ @@ -57,7 +62,7 @@ func provisioningStatePollerFromResponse(response *client.Response, client *Clie client: client, initialRetryDuration: pollingInterval, originalUri: originalUri, - resourcePath: *resourcePath, + resourcePath: resourcePath, }, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 8457337890e9..58fe82885166 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -129,7 +129,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20230803.1095722 +# github.com/hashicorp/go-azure-sdk v0.20230804.1074947 ## explicit; go 1.19 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview From be380afffb7734c1d67584e37b1e98d8c569377b Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Fri, 4 Aug 2023 10:02:04 +0200 Subject: [PATCH 2/3] refactor: updating `arckubernetes`, `bot`, `hsm` and `hybridcompute` to use `go-azure-sdk`'s base layer --- internal/clients/client.go | 12 ++++-- .../services/arckubernetes/client/client.go | 14 +++--- internal/services/bot/client/client.go | 17 +++++--- internal/services/hsm/client/client.go | 15 ++++--- .../services/hybridcompute/client/client.go | 43 ++++++++++++------- 5 files changed, 66 insertions(+), 35 deletions(-) diff --git a/internal/clients/client.go b/internal/clients/client.go index 43c60c2ad866..389634a7c854 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -328,7 +328,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.Blueprints, err = blueprints.NewClient(o); err != nil { return fmt.Errorf("building clients for BluePrints: %+v", err) } - client.Bot = bot.NewClient(o) + if client.Bot, err = bot.NewClient(o); err != nil { + return fmt.Errorf("building clients for Bot: %+v", err) + } client.Cdn = cdn.NewClient(o) if client.Cognitive, err = cognitiveServices.NewClient(o); err != nil { return fmt.Errorf("building clients for Cognitive: %+v", err) @@ -417,12 +419,16 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.HPCCache, err = hpccache.NewClient(o); err != nil { return fmt.Errorf("building clients for HPC Cache: %+v", err) } - client.HSM = hsm.NewClient(o) + if client.HSM, err = hsm.NewClient(o); err != nil { + return fmt.Errorf("building clients for HSM: %+v", err) + } client.HDInsight = hdinsight.NewClient(o) if client.HealthCare, err = healthcare.NewClient(o); err != nil { return fmt.Errorf("building clients for HealthCare: %+v", err) } - client.HybridCompute = hybridcompute.NewClient(o) + if client.HybridCompute, err = hybridcompute.NewClient(o); err != nil { + return fmt.Errorf("building clients for HybridCompute: %+v", err) + } if client.IoTCentral, err = iotcentral.NewClient(o); err != nil { return fmt.Errorf("building clients for IoTCentral: %+v", err) } diff --git a/internal/services/arckubernetes/client/client.go b/internal/services/arckubernetes/client/client.go index d6c12b278512..293f7fe12534 100644 --- a/internal/services/arckubernetes/client/client.go +++ b/internal/services/arckubernetes/client/client.go @@ -19,24 +19,26 @@ type Client struct { } func NewClient(o *common.ClientOptions) (*Client, error) { - - arcKubernetesClient := connectedclusters.NewConnectedClustersClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&arcKubernetesClient.Client, o.ResourceManagerAuthorizer) + arcKubernetesClient, err := connectedclusters.NewConnectedClustersClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building ConnectedClusters client: %+v", err) + } + o.Configure(arcKubernetesClient.Client, o.Authorizers.ResourceManager) extensionsClient, err := extensions.NewExtensionsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { - return nil, fmt.Errorf("building Extensions Client: %+v", err) + return nil, fmt.Errorf("building Extensions client: %+v", err) } o.Configure(extensionsClient.Client, o.Authorizers.ResourceManager) fluxConfigurationClient, err := fluxconfiguration.NewFluxConfigurationClientWithBaseURI(o.Environment.ResourceManager) if err != nil { - return nil, fmt.Errorf("building Flux Configuration Client: %+v", err) + return nil, fmt.Errorf("building FluxConfiguration client: %+v", err) } o.Configure(fluxConfigurationClient.Client, o.Authorizers.ResourceManager) return &Client{ - ArcKubernetesClient: &arcKubernetesClient, + ArcKubernetesClient: arcKubernetesClient, ExtensionsClient: extensionsClient, FluxConfigurationClient: fluxConfigurationClient, }, nil diff --git a/internal/services/bot/client/client.go b/internal/services/bot/client/client.go index 74827a3eb8da..198ed56b2a99 100644 --- a/internal/services/bot/client/client.go +++ b/internal/services/bot/client/client.go @@ -4,8 +4,10 @@ package client import ( - "github.com/Azure/go-autorest/autorest" + "fmt" + healthbot_2022_08_08 "github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) @@ -17,7 +19,7 @@ type Client struct { HealthBotClient *healthbot_2022_08_08.Client } -func NewClient(o *common.ClientOptions) *Client { +func NewClient(o *common.ClientOptions) (*Client, error) { botClient := botservice.NewBotsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&botClient.Client, o.ResourceManagerAuthorizer) @@ -27,14 +29,17 @@ func NewClient(o *common.ClientOptions) *Client { channelClient := botservice.NewChannelsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&channelClient.Client, o.ResourceManagerAuthorizer) - healthBotsClient := healthbot_2022_08_08.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { - o.ConfigureClient(c, o.ResourceManagerAuthorizer) + healthBotsClient, err := healthbot_2022_08_08.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) }) + if err != nil { + return nil, fmt.Errorf("building HealthBots client: %+v", err) + } return &Client{ BotClient: &botClient, ChannelClient: &channelClient, ConnectionClient: &connectionClient, - HealthBotClient: &healthBotsClient, - } + HealthBotClient: healthBotsClient, + }, nil } diff --git a/internal/services/hsm/client/client.go b/internal/services/hsm/client/client.go index 244a7c9431d0..823894019048 100644 --- a/internal/services/hsm/client/client.go +++ b/internal/services/hsm/client/client.go @@ -4,6 +4,8 @@ package client import ( + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -12,11 +14,14 @@ type Client struct { DedicatedHsmClient *dedicatedhsms.DedicatedHsmsClient } -func NewClient(o *common.ClientOptions) *Client { - dedicatedHsmClient := dedicatedhsms.NewDedicatedHsmsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&dedicatedHsmClient.Client, o.ResourceManagerAuthorizer) +func NewClient(o *common.ClientOptions) (*Client, error) { + dedicatedHsmClient, err := dedicatedhsms.NewDedicatedHsmsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building DedicatedHsms client: %+v", err) + } + o.Configure(dedicatedHsmClient.Client, o.Authorizers.ResourceManager) return &Client{ - DedicatedHsmClient: &dedicatedHsmClient, - } + DedicatedHsmClient: dedicatedHsmClient, + }, nil } diff --git a/internal/services/hybridcompute/client/client.go b/internal/services/hybridcompute/client/client.go index 4bad061dfabb..779569edbdc6 100644 --- a/internal/services/hybridcompute/client/client.go +++ b/internal/services/hybridcompute/client/client.go @@ -4,6 +4,8 @@ package client import ( + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machineextensions" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/machines" "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-11-10/privateendpointconnections" @@ -18,24 +20,35 @@ type Client struct { PrivateLinkScopesClient *privatelinkscopes.PrivateLinkScopesClient } -func NewClient(o *common.ClientOptions) *Client { - - machineExtensionsClient := machineextensions.NewMachineExtensionsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&machineExtensionsClient.Client, o.ResourceManagerAuthorizer) +func NewClient(o *common.ClientOptions) (*Client, error) { + machineExtensionsClient, err := machineextensions.NewMachineExtensionsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building MachineExtensions client: %+v", err) + } + o.Configure(machineExtensionsClient.Client, o.Authorizers.ResourceManager) - machinesClient := machines.NewMachinesClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&machinesClient.Client, o.ResourceManagerAuthorizer) + machinesClient, err := machines.NewMachinesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Machines client: %+v", err) + } + o.Configure(machinesClient.Client, o.Authorizers.ResourceManager) - privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + o.Configure(privateEndpointConnectionsClient.Client, o.Authorizers.ResourceManager) - privateLinkScopesClient := privatelinkscopes.NewPrivateLinkScopesClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&privateLinkScopesClient.Client, o.ResourceManagerAuthorizer) + privateLinkScopesClient, err := privatelinkscopes.NewPrivateLinkScopesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkScopes client: %+v", err) + } + o.Configure(privateLinkScopesClient.Client, o.Authorizers.ResourceManager) return &Client{ - MachineExtensionsClient: &machineExtensionsClient, - MachinesClient: &machinesClient, - PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, - PrivateLinkScopesClient: &privateLinkScopesClient, - } + MachineExtensionsClient: machineExtensionsClient, + MachinesClient: machinesClient, + PrivateEndpointConnectionsClient: privateEndpointConnectionsClient, + PrivateLinkScopesClient: privateLinkScopesClient, + }, nil } From c9ef3c6d33a3c8156576de28f034b3f23ab0c148 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Fri, 4 Aug 2023 13:11:20 +0200 Subject: [PATCH 3/3] dependencies: updating to `v0.20230804.1110546` of `github.com/hashicorp/go-azure-sdk` --- go.mod | 2 +- go.sum | 4 ++-- .../go-azure-sdk/sdk/client/resourcemanager/poller_lro.go | 2 ++ vendor/modules.txt | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 72082e21f147..1166ec60d40a 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 github.com/hashicorp/go-azure-helpers v0.57.0 - github.com/hashicorp/go-azure-sdk v0.20230804.1074947 + github.com/hashicorp/go-azure-sdk v0.20230804.1110546 github.com/hashicorp/go-hclog v1.4.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index 0a1f1ce8bee8..81a778908a68 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.57.0 h1:85CWEUtIjMtx8DaXisFbEb2GCWR4S2UZlYvJpSPYoZ4= github.com/hashicorp/go-azure-helpers v0.57.0/go.mod h1:BQUQp5udwbJ8pnzl0wByCLVEEyPMAFpJ9vOREiCzObo= -github.com/hashicorp/go-azure-sdk v0.20230804.1074947 h1:3P1sGIY2J2RzUVCqjCaPcCBlsQyr/mYqIdTO7JXfLPg= -github.com/hashicorp/go-azure-sdk v0.20230804.1074947/go.mod h1:iZrpp7qJSZxocEkr4SjslzxpDrhuRLmedyVGGcCPbhk= +github.com/hashicorp/go-azure-sdk v0.20230804.1110546 h1:yx4wGSFQdp9mWfFWZVOv9W83VhZa/HzzxKYIuiSNz74= +github.com/hashicorp/go-azure-sdk v0.20230804.1110546/go.mod h1:iZrpp7qJSZxocEkr4SjslzxpDrhuRLmedyVGGcCPbhk= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go index d79f9b89621e..50dc7595be36 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go @@ -183,6 +183,8 @@ func (p *longRunningOperationPoller) Poll(ctx context.Context) (result *pollers. "newReplicaGroup": pollers.PollingStatusInProgress, // AnalysisServices @ 2017-08-01 (Servers) returns `Provisioning` during Creation "Provisioning": pollers.PollingStatusInProgress, + // HealthBot @ 2022-08-08 (HealthBots CreateOrUpdate) returns `Working` during Creation + "Working": pollers.PollingStatusInProgress, } for k, v := range statuses { if strings.EqualFold(string(op.Properties.ProvisioningState), string(k)) { diff --git a/vendor/modules.txt b/vendor/modules.txt index 58fe82885166..6796763cde96 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -129,7 +129,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20230804.1074947 +# github.com/hashicorp/go-azure-sdk v0.20230804.1110546 ## explicit; go 1.19 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview