From 36b3decde95ada14063e677f637235f6724a4cbe Mon Sep 17 00:00:00 2001 From: catriona-m <86247157+catriona-m@users.noreply.github.com> Date: Tue, 13 Feb 2024 17:14:51 +0000 Subject: [PATCH] dependencies: updating to v0.20240213.1120950 of `github.com/hashicorp/go-azure-sdk` (#24872) * update go-azure-sdk to v0.20240213.1120950 * update go-azure-sdk to v0.20240213.1120950 --- go.mod | 4 +- go.sum | 8 +- internal/services/containers/client/client.go | 54 +- .../services/containers/client/client_gen.go | 29 +- .../kubernetes_cluster_node_pool_resource.go | 18 +- ...ernetes_cluster_node_pool_resource_test.go | 6 +- .../containers/kubernetes_cluster_resource.go | 34 +- .../kubernetes_cluster_resource_test.go | 6 +- .../2019-08-01/containerservices/client.go | 22 +- .../method_listorchestrators.go | 80 +++ .../method_listorchestrators_autorest.go | 98 --- .../2022-09-02-preview/agentpools/client.go | 22 +- .../agentpools/constants.go | 175 +++++- .../agentpools/method_abortlatestoperation.go | 47 ++ .../method_abortlatestoperation_autorest.go | 67 --- .../agentpools/method_createorupdate.go | 75 +++ .../method_createorupdate_autorest.go | 80 --- .../agentpools/method_delete.go | 98 +++ .../agentpools/method_delete_autorest.go | 107 ---- .../agentpools/method_get.go | 51 ++ .../agentpools/method_get_autorest.go | 68 --- .../method_getavailableagentpoolversions.go | 53 ++ ..._getavailableagentpoolversions_autorest.go | 70 --- .../agentpools/method_getupgradeprofile.go | 52 ++ .../method_getupgradeprofile_autorest.go | 69 --- .../agentpools/method_list.go | 92 +++ .../agentpools/method_list_autorest.go | 187 ------ .../method_upgradenodeimageversion.go | 71 +++ ...method_upgradenodeimageversion_autorest.go | 79 --- .../2022-09-02-preview/client.go | 111 ++-- .../2022-09-02-preview/fleetmembers/client.go | 22 +- .../fleetmembers/constants.go | 19 +- .../fleetmembers/method_create.go | 107 ++++ .../fleetmembers/method_create_autorest.go | 114 ---- .../fleetmembers/method_delete.go | 99 +++ .../fleetmembers/method_delete_autorest.go | 107 ---- .../fleetmembers/method_get.go | 51 ++ .../fleetmembers/method_get_autorest.go | 68 --- .../fleetmembers/method_listbyfleet.go | 91 +++ .../method_listbyfleet_autorest.go | 186 ------ .../2022-09-02-preview/fleets/client.go | 22 +- .../2022-09-02-preview/fleets/constants.go | 19 +- .../fleets/method_createorupdate.go | 107 ++++ .../fleets/method_createorupdate_autorest.go | 114 ---- .../fleets/method_delete.go | 99 +++ .../fleets/method_delete_autorest.go | 107 ---- .../2022-09-02-preview/fleets/method_get.go | 51 ++ .../fleets/method_get_autorest.go | 68 --- .../fleets/method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../fleets/method_listbysubscription.go | 92 +++ .../method_listbysubscription_autorest.go | 187 ------ .../fleets/method_listcredentials.go | 52 ++ .../fleets/method_listcredentials_autorest.go | 69 --- .../fleets/method_update.go | 84 +++ .../fleets/method_update_autorest.go | 98 --- .../maintenanceconfigurations/client.go | 22 +- .../maintenanceconfigurations/constants.go | 19 +- .../method_createorupdate.go | 55 ++ .../method_createorupdate_autorest.go | 69 --- .../method_delete.go | 47 ++ .../method_delete_autorest.go | 66 -- .../maintenanceconfigurations/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../method_listbymanagedcluster.go | 92 +++ .../method_listbymanagedcluster_autorest.go | 187 ------ .../managedclusters/client.go | 22 +- .../managedclusters/constants.go | 474 ++++++++++++++- .../method_abortlatestoperation.go | 48 ++ .../method_abortlatestoperation_autorest.go | 68 --- .../managedclusters/method_createorupdate.go | 76 +++ .../method_createorupdate_autorest.go | 81 --- .../managedclusters/method_delete.go | 99 +++ .../managedclusters/method_delete_autorest.go | 108 ---- .../managedclusters/method_get.go | 52 ++ .../managedclusters/method_get_autorest.go | 69 --- .../method_getaccessprofile.go | 52 ++ .../method_getaccessprofile_autorest.go | 69 --- .../method_getcommandresult.go | 52 ++ .../method_getcommandresult_autorest.go | 68 --- .../managedclusters/method_getosoptions.go | 80 +++ .../method_getosoptions_autorest.go | 98 --- .../method_getupgradeprofile.go | 53 ++ .../method_getupgradeprofile_autorest.go | 70 --- .../managedclusters/method_list.go | 92 +++ .../managedclusters/method_list_autorest.go | 187 ------ .../method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../method_listclusteradmincredentials.go | 81 +++ ...od_listclusteradmincredentials_autorest.go | 99 --- ...od_listclustermonitoringusercredentials.go | 81 +++ ...ustermonitoringusercredentials_autorest.go | 99 --- .../method_listclusterusercredentials.go | 85 +++ ...hod_listclusterusercredentials_autorest.go | 104 ---- ...istoutboundnetworkdependenciesendpoints.go | 92 +++ ...ndnetworkdependenciesendpoints_autorest.go | 187 ------ .../managedclusters/method_resetaadprofile.go | 75 +++ .../method_resetaadprofile_autorest.go | 80 --- .../method_resetserviceprincipalprofile.go | 75 +++ ...d_resetserviceprincipalprofile_autorest.go | 80 --- .../method_rotateclustercertificates.go | 71 +++ ...thod_rotateclustercertificates_autorest.go | 79 --- .../method_rotateserviceaccountsigningkeys.go | 71 +++ ...otateserviceaccountsigningkeys_autorest.go | 79 --- .../managedclusters/method_runcommand.go | 76 +++ .../method_runcommand_autorest.go | 81 --- .../managedclusters/method_start.go | 71 +++ .../managedclusters/method_start_autorest.go | 79 --- .../managedclusters/method_stop.go | 71 +++ .../managedclusters/method_stop_autorest.go | 79 --- .../managedclusters/method_updatetags.go | 75 +++ .../method_updatetags_autorest.go | 81 --- .../managedclustersnapshots/client.go | 22 +- .../managedclustersnapshots/constants.go | 110 +++- .../method_createorupdate.go | 56 ++ .../method_createorupdate_autorest.go | 69 --- .../managedclustersnapshots/method_delete.go | 47 ++ .../method_delete_autorest.go | 66 -- .../managedclustersnapshots/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../managedclustersnapshots/method_list.go | 92 +++ .../method_list_autorest.go | 187 ------ .../method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../method_updatetags.go | 55 ++ .../method_updatetags_autorest.go | 69 --- .../privateendpointconnections/client.go | 22 +- .../privateendpointconnections/constants.go | 32 +- .../method_delete.go | 70 +++ .../method_delete_autorest.go | 78 --- .../privateendpointconnections/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../privateendpointconnections/method_list.go | 53 ++ .../method_list_autorest.go | 70 --- .../method_update.go | 55 ++ .../method_update_autorest.go | 69 --- .../privatelinkresources/client.go | 22 +- .../privatelinkresources/method_list.go | 53 ++ .../method_list_autorest.go | 70 --- .../resolveprivatelinkserviceid/client.go | 22 +- .../method_post.go | 57 ++ .../method_post_autorest.go | 71 --- .../2022-09-02-preview/snapshots/client.go | 22 +- .../2022-09-02-preview/snapshots/constants.go | 45 +- .../snapshots/method_createorupdate.go | 56 ++ .../method_createorupdate_autorest.go | 69 --- .../snapshots/method_delete.go | 47 ++ .../snapshots/method_delete_autorest.go | 66 -- .../snapshots/method_get.go | 51 ++ .../snapshots/method_get_autorest.go | 68 --- .../snapshots/method_list.go | 92 +++ .../snapshots/method_list_autorest.go | 187 ------ .../snapshots/method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../snapshots/method_updatetags.go | 55 ++ .../snapshots/method_updatetags_autorest.go | 69 --- .../trustedaccess/client.go | 22 +- .../trustedaccess/constants.go | 19 +- .../method_rolebindingscreateorupdate.go | 55 ++ ...hod_rolebindingscreateorupdate_autorest.go | 69 --- .../method_rolebindingsdelete.go | 47 ++ .../method_rolebindingsdelete_autorest.go | 66 -- .../trustedaccess/method_rolebindingsget.go | 51 ++ .../method_rolebindingsget_autorest.go | 68 --- .../trustedaccess/method_rolebindingslist.go | 92 +++ .../method_rolebindingslist_autorest.go | 187 ------ .../trustedaccess/method_roleslist.go | 91 +++ .../method_roleslist_autorest.go | 186 ------ .../2023-03-02-preview/agentpools/client.go | 22 +- .../agentpools/constants.go | 175 +++++- .../agentpools/method_abortlatestoperation.go | 70 +++ .../method_abortlatestoperation_autorest.go | 78 --- .../agentpools/method_createorupdate.go | 75 +++ .../method_createorupdate_autorest.go | 80 --- .../agentpools/method_delete.go | 98 +++ .../agentpools/method_delete_autorest.go | 107 ---- .../agentpools/method_get.go | 51 ++ .../agentpools/method_get_autorest.go | 68 --- .../method_getavailableagentpoolversions.go | 53 ++ ..._getavailableagentpoolversions_autorest.go | 70 --- .../agentpools/method_getupgradeprofile.go | 52 ++ .../method_getupgradeprofile_autorest.go | 69 --- .../agentpools/method_list.go | 92 +++ .../agentpools/method_list_autorest.go | 187 ------ .../method_upgradenodeimageversion.go | 71 +++ ...method_upgradenodeimageversion_autorest.go | 79 --- .../2023-03-02-preview/client.go | 93 ++- .../maintenanceconfigurations/client.go | 22 +- .../maintenanceconfigurations/constants.go | 32 +- .../method_createorupdate.go | 55 ++ .../method_createorupdate_autorest.go | 69 --- .../method_delete.go | 47 ++ .../method_delete_autorest.go | 66 -- .../maintenanceconfigurations/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../method_listbymanagedcluster.go | 92 +++ .../method_listbymanagedcluster_autorest.go | 187 ------ .../managedclusters/client.go | 22 +- .../managedclusters/constants.go | 552 ++++++++++++++++- .../method_abortlatestoperation.go | 71 +++ .../method_abortlatestoperation_autorest.go | 79 --- .../managedclusters/method_createorupdate.go | 76 +++ .../method_createorupdate_autorest.go | 81 --- .../managedclusters/method_delete.go | 99 +++ .../managedclusters/method_delete_autorest.go | 108 ---- .../managedclusters/method_get.go | 52 ++ .../managedclusters/method_get_autorest.go | 69 --- .../method_getaccessprofile.go | 52 ++ .../method_getaccessprofile_autorest.go | 69 --- .../method_getcommandresult.go | 52 ++ .../method_getcommandresult_autorest.go | 68 --- .../managedclusters/method_getosoptions.go | 80 +++ .../method_getosoptions_autorest.go | 98 --- .../method_getupgradeprofile.go | 53 ++ .../method_getupgradeprofile_autorest.go | 70 --- .../managedclusters/method_list.go | 92 +++ .../managedclusters/method_list_autorest.go | 187 ------ .../method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../method_listclusteradmincredentials.go | 81 +++ ...od_listclusteradmincredentials_autorest.go | 99 --- ...od_listclustermonitoringusercredentials.go | 81 +++ ...ustermonitoringusercredentials_autorest.go | 99 --- .../method_listclusterusercredentials.go | 85 +++ ...hod_listclusterusercredentials_autorest.go | 104 ---- .../method_listkubernetesversions.go | 52 ++ .../method_listkubernetesversions_autorest.go | 69 --- ...istoutboundnetworkdependenciesendpoints.go | 92 +++ ...ndnetworkdependenciesendpoints_autorest.go | 187 ------ .../managedclusters/method_resetaadprofile.go | 75 +++ .../method_resetaadprofile_autorest.go | 80 --- .../method_resetserviceprincipalprofile.go | 75 +++ ...d_resetserviceprincipalprofile_autorest.go | 80 --- .../method_rotateclustercertificates.go | 71 +++ ...thod_rotateclustercertificates_autorest.go | 79 --- .../method_rotateserviceaccountsigningkeys.go | 71 +++ ...otateserviceaccountsigningkeys_autorest.go | 79 --- .../managedclusters/method_runcommand.go | 76 +++ .../method_runcommand_autorest.go | 81 --- .../managedclusters/method_start.go | 71 +++ .../managedclusters/method_start_autorest.go | 79 --- .../managedclusters/method_stop.go | 71 +++ .../managedclusters/method_stop_autorest.go | 79 --- .../managedclusters/method_updatetags.go | 75 +++ .../method_updatetags_autorest.go | 81 --- .../managedclustersnapshots/client.go | 22 +- .../managedclustersnapshots/constants.go | 110 +++- .../method_createorupdate.go | 56 ++ .../method_createorupdate_autorest.go | 69 --- .../managedclustersnapshots/method_delete.go | 47 ++ .../method_delete_autorest.go | 66 -- .../managedclustersnapshots/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../managedclustersnapshots/method_list.go | 92 +++ .../method_list_autorest.go | 187 ------ .../method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../method_updatetags.go | 55 ++ .../method_updatetags_autorest.go | 69 --- .../privateendpointconnections/client.go | 22 +- .../privateendpointconnections/constants.go | 32 +- .../method_delete.go | 70 +++ .../method_delete_autorest.go | 78 --- .../privateendpointconnections/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../privateendpointconnections/method_list.go | 53 ++ .../method_list_autorest.go | 70 --- .../method_update.go | 55 ++ .../method_update_autorest.go | 69 --- .../privatelinkresources/client.go | 22 +- .../privatelinkresources/method_list.go | 53 ++ .../method_list_autorest.go | 70 --- .../resolveprivatelinkserviceid/client.go | 22 +- .../method_post.go | 57 ++ .../method_post_autorest.go | 71 --- .../2023-03-02-preview/snapshots/client.go | 22 +- .../2023-03-02-preview/snapshots/constants.go | 45 +- .../snapshots/method_createorupdate.go | 56 ++ .../method_createorupdate_autorest.go | 69 --- .../snapshots/method_delete.go | 47 ++ .../snapshots/method_delete_autorest.go | 66 -- .../snapshots/method_get.go | 51 ++ .../snapshots/method_get_autorest.go | 68 --- .../snapshots/method_list.go | 92 +++ .../snapshots/method_list_autorest.go | 187 ------ .../snapshots/method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../snapshots/method_updatetags.go | 55 ++ .../snapshots/method_updatetags_autorest.go | 69 --- .../trustedaccess/client.go | 22 +- .../trustedaccess/constants.go | 19 +- .../method_rolebindingscreateorupdate.go | 55 ++ ...hod_rolebindingscreateorupdate_autorest.go | 69 --- .../method_rolebindingsdelete.go | 47 ++ .../method_rolebindingsdelete_autorest.go | 66 -- .../trustedaccess/method_rolebindingsget.go | 51 ++ .../method_rolebindingsget_autorest.go | 68 --- .../trustedaccess/method_rolebindingslist.go | 92 +++ .../method_rolebindingslist_autorest.go | 187 ------ .../trustedaccess/method_roleslist.go | 91 +++ .../method_roleslist_autorest.go | 186 ------ .../2023-06-02-preview/agentpools/client.go | 22 +- .../agentpools/constants.go | 188 +++++- .../agentpools/method_abortlatestoperation.go | 70 +++ .../method_abortlatestoperation_autorest.go | 78 --- .../agentpools/method_createorupdate.go | 75 +++ .../method_createorupdate_autorest.go | 80 --- .../agentpools/method_delete.go | 98 +++ .../agentpools/method_delete_autorest.go | 107 ---- .../agentpools/method_get.go | 51 ++ .../agentpools/method_get_autorest.go | 68 --- .../method_getavailableagentpoolversions.go | 53 ++ ..._getavailableagentpoolversions_autorest.go | 70 --- .../agentpools/method_getupgradeprofile.go | 52 ++ .../method_getupgradeprofile_autorest.go | 69 --- .../agentpools/method_list.go | 92 +++ .../agentpools/method_list_autorest.go | 187 ------ .../method_upgradenodeimageversion.go | 71 +++ ...method_upgradenodeimageversion_autorest.go | 79 --- .../maintenanceconfigurations/client.go | 22 +- .../maintenanceconfigurations/constants.go | 32 +- .../method_createorupdate.go | 56 ++ .../method_createorupdate_autorest.go | 69 --- .../method_delete.go | 47 ++ .../method_delete_autorest.go | 66 -- .../maintenanceconfigurations/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../method_listbymanagedcluster.go | 92 +++ .../method_listbymanagedcluster_autorest.go | 187 ------ .../managedclusters/client.go | 22 +- .../managedclusters/constants.go | 565 +++++++++++++++++- .../method_abortlatestoperation.go | 71 +++ .../method_abortlatestoperation_autorest.go | 79 --- .../managedclusters/method_createorupdate.go | 76 +++ .../method_createorupdate_autorest.go | 81 --- .../managedclusters/method_delete.go | 99 +++ .../managedclusters/method_delete_autorest.go | 108 ---- .../managedclusters/method_get.go | 52 ++ .../managedclusters/method_get_autorest.go | 69 --- .../method_getaccessprofile.go | 52 ++ .../method_getaccessprofile_autorest.go | 69 --- .../method_getcommandresult.go | 52 ++ .../method_getcommandresult_autorest.go | 68 --- .../method_getmeshrevisionprofile.go | 51 ++ .../method_getmeshrevisionprofile_autorest.go | 68 --- .../method_getmeshupgradeprofile.go | 51 ++ .../method_getmeshupgradeprofile_autorest.go | 68 --- .../managedclusters/method_getosoptions.go | 80 +++ .../method_getosoptions_autorest.go | 98 --- .../method_getupgradeprofile.go | 53 ++ .../method_getupgradeprofile_autorest.go | 70 --- .../managedclusters/method_list.go | 92 +++ .../managedclusters/method_list_autorest.go | 187 ------ .../method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../method_listclusteradmincredentials.go | 81 +++ ...od_listclusteradmincredentials_autorest.go | 99 --- ...od_listclustermonitoringusercredentials.go | 81 +++ ...ustermonitoringusercredentials_autorest.go | 99 --- .../method_listclusterusercredentials.go | 85 +++ ...hod_listclusterusercredentials_autorest.go | 104 ---- .../method_listkubernetesversions.go | 52 ++ .../method_listkubernetesversions_autorest.go | 69 --- .../method_listmeshrevisionprofiles.go | 91 +++ ...ethod_listmeshrevisionprofiles_autorest.go | 186 ------ .../method_listmeshupgradeprofiles.go | 92 +++ ...method_listmeshupgradeprofiles_autorest.go | 187 ------ ...istoutboundnetworkdependenciesendpoints.go | 92 +++ ...ndnetworkdependenciesendpoints_autorest.go | 187 ------ .../managedclusters/method_resetaadprofile.go | 75 +++ .../method_resetaadprofile_autorest.go | 80 --- .../method_resetserviceprincipalprofile.go | 75 +++ ...d_resetserviceprincipalprofile_autorest.go | 80 --- .../method_rotateclustercertificates.go | 71 +++ ...thod_rotateclustercertificates_autorest.go | 79 --- .../method_rotateserviceaccountsigningkeys.go | 71 +++ ...otateserviceaccountsigningkeys_autorest.go | 79 --- .../managedclusters/method_runcommand.go | 76 +++ .../method_runcommand_autorest.go | 81 --- .../managedclusters/method_start.go | 71 +++ .../managedclusters/method_start_autorest.go | 79 --- .../managedclusters/method_stop.go | 71 +++ .../managedclusters/method_stop_autorest.go | 79 --- .../managedclusters/method_updatetags.go | 75 +++ .../method_updatetags_autorest.go | 81 --- .../2023-06-02-preview/snapshots/client.go | 22 +- .../2023-06-02-preview/snapshots/constants.go | 45 +- .../snapshots/method_createorupdate.go | 56 ++ .../method_createorupdate_autorest.go | 69 --- .../snapshots/method_delete.go | 47 ++ .../snapshots/method_delete_autorest.go | 66 -- .../snapshots/method_get.go | 51 ++ .../snapshots/method_get_autorest.go | 68 --- .../snapshots/method_list.go | 92 +++ .../snapshots/method_list_autorest.go | 187 ------ .../snapshots/method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../snapshots/method_updatetags.go | 55 ++ .../snapshots/method_updatetags_autorest.go | 69 --- .../containerservice/2023-10-15/client.go | 48 +- .../2023-10-15/fleetmembers/client.go | 22 +- .../2023-10-15/fleetmembers/constants.go | 19 +- .../2023-10-15/fleetmembers/method_create.go | 107 ++++ .../fleetmembers/method_create_autorest.go | 114 ---- .../2023-10-15/fleetmembers/method_delete.go | 99 +++ .../fleetmembers/method_delete_autorest.go | 107 ---- .../2023-10-15/fleetmembers/method_get.go | 51 ++ .../fleetmembers/method_get_autorest.go | 68 --- .../fleetmembers/method_listbyfleet.go | 91 +++ .../method_listbyfleet_autorest.go | 186 ------ .../2023-10-15/fleetmembers/method_update.go | 103 ++++ .../fleetmembers/method_update_autorest.go | 109 ---- .../2023-10-15/fleets/client.go | 22 +- .../2023-10-15/fleets/constants.go | 19 +- .../fleets/method_createorupdate.go | 107 ++++ .../fleets/method_createorupdate_autorest.go | 114 ---- .../2023-10-15/fleets/method_delete.go | 99 +++ .../fleets/method_delete_autorest.go | 107 ---- .../2023-10-15/fleets/method_get.go | 51 ++ .../2023-10-15/fleets/method_get_autorest.go | 68 --- .../fleets/method_listbyresourcegroup.go | 92 +++ .../method_listbyresourcegroup_autorest.go | 187 ------ .../fleets/method_listbysubscription.go | 92 +++ .../method_listbysubscription_autorest.go | 187 ------ .../fleets/method_listcredentials.go | 52 ++ .../fleets/method_listcredentials_autorest.go | 69 --- .../2023-10-15/fleets/method_update.go | 103 ++++ .../fleets/method_update_autorest.go | 109 ---- .../fleetupdatestrategies/client.go | 22 +- .../fleetupdatestrategies/constants.go | 19 +- .../method_createorupdate.go | 107 ++++ .../method_createorupdate_autorest.go | 114 ---- .../fleetupdatestrategies/method_delete.go | 99 +++ .../method_delete_autorest.go | 107 ---- .../fleetupdatestrategies/method_get.go | 51 ++ .../method_get_autorest.go | 68 --- .../method_listbyfleet.go | 91 +++ .../method_listbyfleet_autorest.go | 186 ------ .../2023-10-15/updateruns/client.go | 22 +- .../2023-10-15/updateruns/constants.go | 58 +- .../updateruns/method_createorupdate.go | 107 ++++ .../method_createorupdate_autorest.go | 114 ---- .../2023-10-15/updateruns/method_delete.go | 99 +++ .../updateruns/method_delete_autorest.go | 107 ---- .../2023-10-15/updateruns/method_get.go | 51 ++ .../updateruns/method_get_autorest.go | 68 --- .../updateruns/method_listbyfleet.go | 91 +++ .../updateruns/method_listbyfleet_autorest.go | 186 ------ .../2023-10-15/updateruns/method_start.go | 99 +++ .../updateruns/method_start_autorest.go | 108 ---- .../2023-10-15/updateruns/method_stop.go | 99 +++ .../updateruns/method_stop_autorest.go | 108 ---- vendor/modules.txt | 4 +- 453 files changed, 17427 insertions(+), 20069 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listcredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listcredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getosoptions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getosoptions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_updatetags.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_updatetags_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go diff --git a/go.mod b/go.mod index eb3979107e79..c9d12fdc51e9 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.1 github.com/hashicorp/go-azure-helpers v0.66.2 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20240212.1141705 - github.com/hashicorp/go-azure-sdk/sdk v0.20240212.1141705 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20240213.1120950 + github.com/hashicorp/go-azure-sdk/sdk v0.20240213.1120950 github.com/hashicorp/go-hclog v1.5.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 828205f7577e..2f58850e3d3c 100644 --- a/go.sum +++ b/go.sum @@ -115,10 +115,10 @@ 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.66.2 h1:+Pzuo7pdKl0hBXXr5ymmhs4Q40tHAo2nAvHq4WgSjx8= github.com/hashicorp/go-azure-helpers v0.66.2/go.mod h1:kJxXrFtJKJdOEqvad8pllAe7dhP4DbN8J6sqFZe47+4= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240212.1141705 h1:qIH/cpVc/T+WzdYMrMfzws1zNPoIacnRywMvsM6YSnA= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240212.1141705/go.mod h1:8r61Qif0/pIfRzSnHa9gwsz/VzQGUjAD+VOkhPBBJyg= -github.com/hashicorp/go-azure-sdk/sdk v0.20240212.1141705 h1:AkeqkfXTenFKUI5MFwE+TGa9cUG3x9ooH2RQfJDQcqQ= -github.com/hashicorp/go-azure-sdk/sdk v0.20240212.1141705/go.mod h1:IKIPyL+hfFWBHABKT0NOWlIEzlusiUBG0SxIfaiv278= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240213.1120950 h1:7cf9ylAgm/XUdFWIr/kYSYGz0LGcoYdTDqFzRGdNcsM= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240213.1120950/go.mod h1:+DvnI11GIdnPla3R+CuTBFnrh28wBo1z4VIVPN+lspM= +github.com/hashicorp/go-azure-sdk/sdk v0.20240213.1120950 h1:u0jSAOvoRxhKlr9rISiIGFOMtB/dFQunszxLH8zwgrE= +github.com/hashicorp/go-azure-sdk/sdk v0.20240213.1120950/go.mod h1:IKIPyL+hfFWBHABKT0NOWlIEzlusiUBG0SxIfaiv278= 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/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index 6e2cb3afc109..60393e0f6b84 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -57,11 +57,17 @@ func NewContainersClient(o *common.ClientOptions) (*Client, error) { } // AKS - fleetUpdateStrategiesClient := fleetupdatestrategies.NewFleetUpdateStrategiesClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&fleetUpdateStrategiesClient.Client, o.ResourceManagerAuthorizer) + fleetUpdateStrategiesClient, err := fleetupdatestrategies.NewFleetUpdateStrategiesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Fleet Update Strategies Client: %+v", err) + } + o.Configure(fleetUpdateStrategiesClient.Client, o.Authorizers.ResourceManager) - kubernetesClustersClient := managedclusters.NewManagedClustersClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&kubernetesClustersClient.Client, o.ResourceManagerAuthorizer) + kubernetesClustersClient, err := managedclusters.NewManagedClustersClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Kubernetes Clusters Client: %+v", err) + } + o.Configure(kubernetesClustersClient.Client, o.Authorizers.ResourceManager) kubernetesExtensionsClient, err := extensions.NewExtensionsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -75,30 +81,42 @@ func NewContainersClient(o *common.ClientOptions) (*Client, error) { } o.Configure(fluxConfigurationClient.Client, o.Authorizers.ResourceManager) - agentPoolsClient := agentpools.NewAgentPoolsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&agentPoolsClient.Client, o.ResourceManagerAuthorizer) + agentPoolsClient, err := agentpools.NewAgentPoolsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Agent Pools Client: %+v", err) + } + o.Configure(agentPoolsClient.Client, o.Authorizers.ResourceManager) - maintenanceConfigurationsClient := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&maintenanceConfigurationsClient.Client, o.ResourceManagerAuthorizer) + maintenanceConfigurationsClient, err := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Maintenance Configurations Client: %+v", err) + } + o.Configure(maintenanceConfigurationsClient.Client, o.Authorizers.ResourceManager) - servicesClient := containerservices.NewContainerServicesClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&servicesClient.Client, o.ResourceManagerAuthorizer) + servicesClient, err := containerservices.NewContainerServicesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Services Client: %+v", err) + } + o.Configure(servicesClient.Client, o.Authorizers.ResourceManager) - snapshotClient := snapshots.NewSnapshotsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&snapshotClient.Client, o.ResourceManagerAuthorizer) + snapshotClient, err := snapshots.NewSnapshotsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Snapshot Client: %+v", err) + } + o.Configure(snapshotClient.Client, o.Authorizers.ResourceManager) return &Client{ - AgentPoolsClient: &agentPoolsClient, + AgentPoolsClient: agentPoolsClient, ContainerInstanceClient: &containerInstanceClient, ContainerRegistryClient_v2021_08_01_preview: containerRegistryClient_v2021_08_01_preview, ContainerRegistryClient_v2019_06_01_preview: containerRegistryClient_v2019_06_01_preview, - FleetUpdateStrategiesClient: &fleetUpdateStrategiesClient, - KubernetesClustersClient: &kubernetesClustersClient, + FleetUpdateStrategiesClient: fleetUpdateStrategiesClient, + KubernetesClustersClient: kubernetesClustersClient, KubernetesExtensionsClient: kubernetesExtensionsClient, KubernetesFluxConfigurationClient: fluxConfigurationClient, - MaintenanceConfigurationsClient: &maintenanceConfigurationsClient, - ServicesClient: &servicesClient, - SnapshotClient: &snapshotClient, + MaintenanceConfigurationsClient: maintenanceConfigurationsClient, + ServicesClient: servicesClient, + SnapshotClient: snapshotClient, Environment: o.AzureEnvironment, }, nil } diff --git a/internal/services/containers/client/client_gen.go b/internal/services/containers/client/client_gen.go index ed1f4d499a36..1a1045655b07 100644 --- a/internal/services/containers/client/client_gen.go +++ b/internal/services/containers/client/client_gen.go @@ -1,32 +1,41 @@ package client import ( - "github.com/Azure/go-autorest/autorest" containerserviceV20220902Preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview" containerserviceV20230302Preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview" containerserviceV20231015 "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type AutoClient struct { - V20220902Preview containerserviceV20220902Preview.Client - V20230302Preview containerserviceV20230302Preview.Client - V20231015 containerserviceV20231015.Client + V20220902Preview *containerserviceV20220902Preview.Client + V20230302Preview *containerserviceV20230302Preview.Client + V20231015 *containerserviceV20231015.Client } func NewClient(o *common.ClientOptions) (*AutoClient, error) { - v20220902PreviewClient := containerserviceV20220902Preview.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { - o.ConfigureClient(c, o.ResourceManagerAuthorizer) + v20220902PreviewClient, err := containerserviceV20220902Preview.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) }) + if err != nil { + return nil, err + } - v20230302PreviewClient := containerserviceV20230302Preview.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { - o.ConfigureClient(c, o.ResourceManagerAuthorizer) + v20230302PreviewClient, err := containerserviceV20230302Preview.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) }) + if err != nil { + return nil, err + } - v20231015Client := containerserviceV20231015.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { - o.ConfigureClient(c, o.ResourceManagerAuthorizer) + v20231015Client, err := containerserviceV20231015.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) }) + if err != nil { + return nil, err + } return &AutoClient{ V20220902Preview: v20220902PreviewClient, diff --git a/internal/services/containers/kubernetes_cluster_node_pool_resource.go b/internal/services/containers/kubernetes_cluster_node_pool_resource.go index 0a4ab51c4ccc..6ef5c4fba494 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_resource.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_resource.go @@ -667,15 +667,11 @@ func resourceKubernetesClusterNodePoolCreate(d *pluginsdk.ResourceData, meta int Properties: &profile, } - future, err := poolsClient.CreateOrUpdate(ctx, id, parameters) + err = poolsClient.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKubernetesClusterNodePoolRead(d, meta) } @@ -833,15 +829,11 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int log.Printf("[DEBUG] Updating existing %s..", *id) existing.Model.Properties = props - future, err := client.CreateOrUpdate(ctx, *id, *existing.Model) + err = client.CreateOrUpdateThenPoll(ctx, *id, *existing.Model) if err != nil { return fmt.Errorf("updating Node Pool %s: %+v", *id, err) } - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } - d.Partial(false) return resourceKubernetesClusterNodePoolRead(d, meta) @@ -1065,17 +1057,13 @@ func resourceKubernetesClusterNodePoolDelete(d *pluginsdk.ResourceData, meta int } ignorePodDisruptionBudget := true - future, err := client.Delete(ctx, *id, agentpools.DeleteOperationOptions{ + err = client.DeleteThenPoll(ctx, *id, agentpools.DeleteOperationOptions{ IgnorePodDisruptionBudget: &ignorePodDisruptionBudget, }) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", id, err) - } - return nil } diff --git a/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go b/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go index 507710678e57..34ec93e1cf3f 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go @@ -1152,15 +1152,11 @@ func (KubernetesClusterNodePoolResource) scaleNodePool(nodeCount int) acceptance nodePool.Model.Properties.Count = utils.Int64(int64(nodeCount)) - future, err := clients.Containers.AgentPoolsClient.CreateOrUpdate(ctx, parsedAgentPoolId, *nodePool.Model) + err = clients.Containers.AgentPoolsClient.CreateOrUpdateThenPoll(ctx, parsedAgentPoolId, *nodePool.Model) if err != nil { return fmt.Errorf("Bad: updating node pool %q: %+v", nodePoolName, err) } - if err := future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("Bad: waiting for update of node pool %q: %+v", nodePoolName, err) - } - return nil } } diff --git a/internal/services/containers/kubernetes_cluster_resource.go b/internal/services/containers/kubernetes_cluster_resource.go index 5f0c7dc20a99..92cc12172a57 100644 --- a/internal/services/containers/kubernetes_cluster_resource.go +++ b/internal/services/containers/kubernetes_cluster_resource.go @@ -1838,15 +1838,11 @@ func resourceKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interface{} parameters.Properties.ServiceMeshProfile = serviceMeshProfile } - future, err := client.CreateOrUpdate(ctx, id, parameters) + err = client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - if maintenanceConfigRaw, ok := d.GetOk("maintenance_window"); ok { client := meta.(*clients.Client).Containers.MaintenanceConfigurationsClient parameters := maintenanceconfigurations.MaintenanceConfiguration{ @@ -1935,13 +1931,10 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} Secret: utils.String(clientSecret), } - future, err := clusterClient.ResetServicePrincipalProfile(ctx, *id, params) + err = clusterClient.ResetServicePrincipalProfileThenPoll(ctx, *id, params) if err != nil { return fmt.Errorf("updating Service Principal for %s: %+v", *id, err) } - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for update of Service Principal for %s: %+v", *id, err) - } log.Printf("[DEBUG] Updated the Service Principal for %s.", *id) // since we're patching it, re-retrieve the latest version of the cluster @@ -1984,14 +1977,10 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} props.AadProfile = azureADProfile if props.AadProfile != nil && (props.AadProfile.Managed == nil || !*props.AadProfile.Managed) { log.Printf("[DEBUG] Updating the RBAC AAD profile") - future, err := clusterClient.ResetAADProfile(ctx, *id, *props.AadProfile) + err = clusterClient.ResetAADProfileThenPoll(ctx, *id, *props.AadProfile) if err != nil { return fmt.Errorf("updating Managed Kubernetes Cluster AAD Profile for %s: %+v", *id, err) } - - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for update of RBAC AAD profile of %s: %+v", *id, err) - } } if props.AadProfile != nil && props.AadProfile.Managed != nil && *props.AadProfile.Managed { @@ -2345,14 +2334,11 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} } log.Printf("[DEBUG] Updating %s..", *id) - future, err := clusterClient.CreateOrUpdate(ctx, *id, *existing.Model) + err = clusterClient.CreateOrUpdateThenPoll(ctx, *id, *existing.Model) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } log.Printf("[DEBUG] Updated %s..", *id) } @@ -2370,15 +2356,11 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} log.Printf("[DEBUG] Upgrading the version of Kubernetes to %q..", kubernetesVersion) existing.Model.Properties.KubernetesVersion = utils.String(kubernetesVersion) - future, err := clusterClient.CreateOrUpdate(ctx, *id, *existing.Model) + err = clusterClient.CreateOrUpdateThenPoll(ctx, *id, *existing.Model) if err != nil { return fmt.Errorf("updating Kubernetes Version for %s: %+v", *id, err) } - if err = future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } - log.Printf("[DEBUG] Upgraded the version of Kubernetes to %q..", kubernetesVersion) } @@ -2905,17 +2887,13 @@ func resourceKubernetesClusterDelete(d *pluginsdk.ResourceData, meta interface{} } ignorePodDisruptionBudget := true - future, err := client.Delete(ctx, *id, managedclusters.DeleteOperationOptions{ + err = client.DeleteThenPoll(ctx, *id, managedclusters.DeleteOperationOptions{ IgnorePodDisruptionBudget: &ignorePodDisruptionBudget, }) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/containers/kubernetes_cluster_resource_test.go b/internal/services/containers/kubernetes_cluster_resource_test.go index b3c2a8d25e3f..978b05d401cf 100644 --- a/internal/services/containers/kubernetes_cluster_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_resource_test.go @@ -237,15 +237,11 @@ func (KubernetesClusterResource) updateDefaultNodePoolAgentCount(nodeCount int) nodePool.Model.Properties.Count = utils.Int64(int64(nodeCount)) - future, err := clients.Containers.AgentPoolsClient.CreateOrUpdate(ctx, agentPoolId, *nodePool.Model) + err = clients.Containers.AgentPoolsClient.CreateOrUpdateThenPoll(ctx, agentPoolId, *nodePool.Model) if err != nil { return fmt.Errorf("Bad: updating node pool %q: %+v", nodePoolName, err) } - if err := future.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("Bad: waiting for update of node pool %q: %+v", nodePoolName, err) - } - return nil } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go index 5b5e29cecb06..dbb918e99a68 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go @@ -1,18 +1,26 @@ package containerservices -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 ContainerServicesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewContainerServicesClientWithBaseURI(endpoint string) ContainerServicesClient { - return ContainerServicesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewContainerServicesClientWithBaseURI(sdkApi sdkEnv.Api) (*ContainerServicesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "containerservices", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContainerServicesClient: %+v", err) } + + return &ContainerServicesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators.go new file mode 100644 index 000000000000..8f0903c4e688 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators.go @@ -0,0 +1,80 @@ +package containerservices + +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 ListOrchestratorsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OrchestratorVersionProfileListResult +} + +type ListOrchestratorsOperationOptions struct { + ResourceType *string +} + +func DefaultListOrchestratorsOperationOptions() ListOrchestratorsOperationOptions { + return ListOrchestratorsOperationOptions{} +} + +func (o ListOrchestratorsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOrchestratorsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOrchestratorsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ResourceType != nil { + out.Append("resource-type", fmt.Sprintf("%v", *o.ResourceType)) + } + return &out +} + +// ListOrchestrators ... +func (c ContainerServicesClient) ListOrchestrators(ctx context.Context, id LocationId, options ListOrchestratorsOperationOptions) (result ListOrchestratorsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/orchestrators", 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/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go deleted file mode 100644 index 88eef13a3db9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package containerservices - -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 ListOrchestratorsOperationResponse struct { - HttpResponse *http.Response - Model *OrchestratorVersionProfileListResult -} - -type ListOrchestratorsOperationOptions struct { - ResourceType *string -} - -func DefaultListOrchestratorsOperationOptions() ListOrchestratorsOperationOptions { - return ListOrchestratorsOperationOptions{} -} - -func (o ListOrchestratorsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOrchestratorsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ResourceType != nil { - out["resource-type"] = *o.ResourceType - } - - return out -} - -// ListOrchestrators ... -func (c ContainerServicesClient) ListOrchestrators(ctx context.Context, id LocationId, options ListOrchestratorsOperationOptions) (result ListOrchestratorsOperationResponse, err error) { - req, err := c.preparerForListOrchestrators(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservices.ContainerServicesClient", "ListOrchestrators", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservices.ContainerServicesClient", "ListOrchestrators", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListOrchestrators(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservices.ContainerServicesClient", "ListOrchestrators", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListOrchestrators prepares the ListOrchestrators request. -func (c ContainerServicesClient) preparerForListOrchestrators(ctx context.Context, id LocationId, options ListOrchestratorsOperationOptions) (*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/orchestrators", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListOrchestrators handles the response to the ListOrchestrators request. The method always -// closes the http.Response Body. -func (c ContainerServicesClient) responderForListOrchestrators(resp *http.Response) (result ListOrchestratorsOperationResponse, 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/containerservice/2022-09-02-preview/agentpools/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/client.go index f4128f5c794c..2edad36c0059 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/client.go @@ -1,18 +1,26 @@ package agentpools -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 AgentPoolsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAgentPoolsClientWithBaseURI(endpoint string) AgentPoolsClient { - return AgentPoolsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAgentPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*AgentPoolsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "agentpools", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AgentPoolsClient: %+v", err) } + + return &AgentPoolsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/constants.go index 85f3468bbbfa..c73e2223e5c8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/constants.go @@ -1,6 +1,10 @@ package agentpools -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 PossibleValuesForAgentPoolMode() []string { } } +func (s *AgentPoolMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolMode(input string) (*AgentPoolMode, error) { vals := map[string]AgentPoolMode{ "system": AgentPoolModeSystem, @@ -47,6 +64,19 @@ func PossibleValuesForAgentPoolType() []string { } } +func (s *AgentPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolType(input string) (*AgentPoolType, error) { vals := map[string]AgentPoolType{ "availabilityset": AgentPoolTypeAvailabilitySet, @@ -75,6 +105,19 @@ func PossibleValuesForCode() []string { } } +func (s *Code) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCode(input string) (*Code, error) { vals := map[string]Code{ "running": CodeRunning, @@ -109,6 +152,19 @@ func PossibleValuesForGPUInstanceProfile() []string { } } +func (s *GPUInstanceProfile) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGPUInstanceProfile(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGPUInstanceProfile(input string) (*GPUInstanceProfile, error) { vals := map[string]GPUInstanceProfile{ "mig4g": GPUInstanceProfileMIGFourg, @@ -140,6 +196,19 @@ func PossibleValuesForKubeletDiskType() []string { } } +func (s *KubeletDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubeletDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubeletDiskType(input string) (*KubeletDiskType, error) { vals := map[string]KubeletDiskType{ "os": KubeletDiskTypeOS, @@ -168,6 +237,19 @@ func PossibleValuesForOSDiskType() []string { } } +func (s *OSDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSDiskType(input string) (*OSDiskType, error) { vals := map[string]OSDiskType{ "ephemeral": OSDiskTypeEphemeral, @@ -202,6 +284,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "cblmariner": OSSKUCBLMariner, @@ -233,6 +328,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -261,6 +369,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTCP, @@ -289,6 +410,19 @@ func PossibleValuesForScaleDownMode() []string { } } +func (s *ScaleDownMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleDownMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleDownMode(input string) (*ScaleDownMode, error) { vals := map[string]ScaleDownMode{ "deallocate": ScaleDownModeDeallocate, @@ -317,6 +451,19 @@ func PossibleValuesForScaleSetEvictionPolicy() []string { } } +func (s *ScaleSetEvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetEvictionPolicy(input string) (*ScaleSetEvictionPolicy, error) { vals := map[string]ScaleSetEvictionPolicy{ "deallocate": ScaleSetEvictionPolicyDeallocate, @@ -345,6 +492,19 @@ func PossibleValuesForScaleSetPriority() []string { } } +func (s *ScaleSetPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetPriority(input string) (*ScaleSetPriority, error) { vals := map[string]ScaleSetPriority{ "regular": ScaleSetPriorityRegular, @@ -373,6 +533,19 @@ func PossibleValuesForWorkloadRuntime() []string { } } +func (s *WorkloadRuntime) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadRuntime(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWorkloadRuntime(input string) (*WorkloadRuntime, error) { vals := map[string]WorkloadRuntime{ "ocicontainer": WorkloadRuntimeOCIContainer, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation.go new file mode 100644 index 000000000000..73ed62c1100f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation.go @@ -0,0 +1,47 @@ +package agentpools + +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 AbortLatestOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// AbortLatestOperation ... +func (c AgentPoolsClient) AbortLatestOperation(ctx context.Context, id AgentPoolId) (result AbortLatestOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/abort", 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/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation_autorest.go deleted file mode 100644 index 5cb3e504f4bc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_abortlatestoperation_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package agentpools - -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 AbortLatestOperationOperationResponse struct { - HttpResponse *http.Response -} - -// AbortLatestOperation ... -func (c AgentPoolsClient) AbortLatestOperation(ctx context.Context, id AgentPoolId) (result AbortLatestOperationOperationResponse, err error) { - req, err := c.preparerForAbortLatestOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAbortLatestOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAbortLatestOperation prepares the AbortLatestOperation request. -func (c AgentPoolsClient) preparerForAbortLatestOperation(ctx context.Context, id AgentPoolId) (*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/abort", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAbortLatestOperation handles the response to the AbortLatestOperation request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForAbortLatestOperation(resp *http.Response) (result AbortLatestOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate.go new file mode 100644 index 000000000000..8df06205d3a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate.go @@ -0,0 +1,75 @@ +package agentpools + +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 + Model *AgentPool +} + +// CreateOrUpdate ... +func (c AgentPoolsClient) CreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AgentPoolsClient) CreateOrUpdateThenPoll(ctx context.Context, id AgentPoolId, input AgentPool) 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/containerservice/2022-09-02-preview/agentpools/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate_autorest.go deleted file mode 100644 index 376fc7fd167f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_createorupdate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package agentpools - -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 - Model *AgentPool -} - -// CreateOrUpdate ... -func (c AgentPoolsClient) CreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c AgentPoolsClient) CreateOrUpdateThenPoll(ctx context.Context, id AgentPoolId, input AgentPool) 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 AgentPoolsClient) preparerForCreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (*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 AgentPoolsClient) 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/containerservice/2022-09-02-preview/agentpools/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_delete.go new file mode 100644 index 000000000000..d628abea0ea4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_delete.go @@ -0,0 +1,98 @@ +package agentpools + +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 +} + +type DeleteOperationOptions struct { + IgnorePodDisruptionBudget *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IgnorePodDisruptionBudget != nil { + out.Append("ignore-pod-disruption-budget", fmt.Sprintf("%v", *o.IgnorePodDisruptionBudget)) + } + return &out +} + +// Delete ... +func (c AgentPoolsClient) Delete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AgentPoolsClient) DeleteThenPoll(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2022-09-02-preview/agentpools/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_delete_autorest.go deleted file mode 100644 index 4acc91111ca3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package agentpools - -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 -} - -type DeleteOperationOptions struct { - IgnorePodDisruptionBudget *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IgnorePodDisruptionBudget != nil { - out["ignore-pod-disruption-budget"] = *o.IgnorePodDisruptionBudget - } - - return out -} - -// Delete ... -func (c AgentPoolsClient) Delete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c AgentPoolsClient) DeleteThenPoll(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 AgentPoolsClient) preparerForDelete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 AgentPoolsClient) 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/containerservice/2022-09-02-preview/agentpools/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_get.go new file mode 100644 index 000000000000..ad9eccae1761 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_get.go @@ -0,0 +1,51 @@ +package agentpools + +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 *AgentPool +} + +// Get ... +func (c AgentPoolsClient) Get(ctx context.Context, id AgentPoolId) (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/containerservice/2022-09-02-preview/agentpools/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_get_autorest.go deleted file mode 100644 index 989893ea89d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package agentpools - -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 *AgentPool -} - -// Get ... -func (c AgentPoolsClient) Get(ctx context.Context, id AgentPoolId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AgentPoolsClient) preparerForGet(ctx context.Context, id AgentPoolId) (*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 AgentPoolsClient) 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/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions.go new file mode 100644 index 000000000000..2b16f4ecd6aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions.go @@ -0,0 +1,53 @@ +package agentpools + +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 GetAvailableAgentPoolVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPoolAvailableVersions +} + +// GetAvailableAgentPoolVersions ... +func (c AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (result GetAvailableAgentPoolVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/availableAgentPoolVersions", 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/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go deleted file mode 100644 index 73e49c546708..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package agentpools - -import ( - "context" - "fmt" - "net/http" - - "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 GetAvailableAgentPoolVersionsOperationResponse struct { - HttpResponse *http.Response - Model *AgentPoolAvailableVersions -} - -// GetAvailableAgentPoolVersions ... -func (c AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (result GetAvailableAgentPoolVersionsOperationResponse, err error) { - req, err := c.preparerForGetAvailableAgentPoolVersions(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAvailableAgentPoolVersions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAvailableAgentPoolVersions prepares the GetAvailableAgentPoolVersions request. -func (c AgentPoolsClient) preparerForGetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (*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/availableAgentPoolVersions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAvailableAgentPoolVersions handles the response to the GetAvailableAgentPoolVersions request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForGetAvailableAgentPoolVersions(resp *http.Response) (result GetAvailableAgentPoolVersionsOperationResponse, 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/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile.go new file mode 100644 index 000000000000..518140ec5e80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile.go @@ -0,0 +1,52 @@ +package agentpools + +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 GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPoolUpgradeProfile +} + +// GetUpgradeProfile ... +func (c AgentPoolsClient) GetUpgradeProfile(ctx context.Context, id AgentPoolId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/upgradeProfiles/default", 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/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile_autorest.go deleted file mode 100644 index 0a94e7b1cd75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_getupgradeprofile_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package agentpools - -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 GetUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *AgentPoolUpgradeProfile -} - -// GetUpgradeProfile ... -func (c AgentPoolsClient) GetUpgradeProfile(ctx context.Context, id AgentPoolId) (result GetUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetUpgradeProfile prepares the GetUpgradeProfile request. -func (c AgentPoolsClient) preparerForGetUpgradeProfile(ctx context.Context, id AgentPoolId) (*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/upgradeProfiles/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetUpgradeProfile handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForGetUpgradeProfile(resp *http.Response) (result GetUpgradeProfileOperationResponse, 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/containerservice/2022-09-02-preview/agentpools/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list.go new file mode 100644 index 000000000000..d4f58e969de4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list.go @@ -0,0 +1,92 @@ +package agentpools + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AgentPool +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AgentPool +} + +// List ... +func (c AgentPoolsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/agentPools", 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 *[]AgentPool `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 AgentPoolsClient) ListComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AgentPoolsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate AgentPoolOperationPredicate) (result ListCompleteResult, err error) { + items := make([]AgentPool, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list_autorest.go deleted file mode 100644 index 85002f4ba417..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package agentpools - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]AgentPool - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []AgentPool -} - -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) -} - -// List ... -func (c AgentPoolsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c AgentPoolsClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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/agentPools", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c AgentPoolsClient) 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 AgentPoolsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []AgentPool `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, "agentpools.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c AgentPoolsClient) ListComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AgentPoolsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate AgentPoolOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]AgentPool, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion.go new file mode 100644 index 000000000000..fa6b0240a55f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion.go @@ -0,0 +1,71 @@ +package agentpools + +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 UpgradeNodeImageVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AgentPool +} + +// UpgradeNodeImageVersion ... +func (c AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (result UpgradeNodeImageVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeNodeImageVersion", 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 +} + +// UpgradeNodeImageVersionThenPoll performs UpgradeNodeImageVersion then polls until it's completed +func (c AgentPoolsClient) UpgradeNodeImageVersionThenPoll(ctx context.Context, id AgentPoolId) error { + result, err := c.UpgradeNodeImageVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing UpgradeNodeImageVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpgradeNodeImageVersion: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion_autorest.go deleted file mode 100644 index 8f804652e0fa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/method_upgradenodeimageversion_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package agentpools - -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 UpgradeNodeImageVersionOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *AgentPool -} - -// UpgradeNodeImageVersion ... -func (c AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (result UpgradeNodeImageVersionOperationResponse, err error) { - req, err := c.preparerForUpgradeNodeImageVersion(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "UpgradeNodeImageVersion", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpgradeNodeImageVersion(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "UpgradeNodeImageVersion", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpgradeNodeImageVersionThenPoll performs UpgradeNodeImageVersion then polls until it's completed -func (c AgentPoolsClient) UpgradeNodeImageVersionThenPoll(ctx context.Context, id AgentPoolId) error { - result, err := c.UpgradeNodeImageVersion(ctx, id) - if err != nil { - return fmt.Errorf("performing UpgradeNodeImageVersion: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after UpgradeNodeImageVersion: %+v", err) - } - - return nil -} - -// preparerForUpgradeNodeImageVersion prepares the UpgradeNodeImageVersion request. -func (c AgentPoolsClient) preparerForUpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (*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/upgradeNodeImageVersion", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpgradeNodeImageVersion sends the UpgradeNodeImageVersion request. The method will close the -// http.Response Body if it receives an error. -func (c AgentPoolsClient) senderForUpgradeNodeImageVersion(ctx context.Context, req *http.Request) (future UpgradeNodeImageVersionOperationResponse, 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/containerservice/2022-09-02-preview/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/client.go index 39510eed0f9a..772fd31c63d7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/client.go @@ -4,7 +4,8 @@ package v2022_09_02_preview // 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/containerservice/2022-09-02-preview/agentpools" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets" @@ -16,6 +17,8 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -32,52 +35,84 @@ type Client struct { TrustedAccess *trustedaccess.TrustedAccessClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - agentPoolsClient := agentpools.NewAgentPoolsClientWithBaseURI(endpoint) - configureAuthFunc(&agentPoolsClient.Client) - - fleetMembersClient := fleetmembers.NewFleetMembersClientWithBaseURI(endpoint) - configureAuthFunc(&fleetMembersClient.Client) +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + agentPoolsClient, err := agentpools.NewAgentPoolsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AgentPools client: %+v", err) + } + configureFunc(agentPoolsClient.Client) - fleetsClient := fleets.NewFleetsClientWithBaseURI(endpoint) - configureAuthFunc(&fleetsClient.Client) + fleetMembersClient, err := fleetmembers.NewFleetMembersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building FleetMembers client: %+v", err) + } + configureFunc(fleetMembersClient.Client) - maintenanceConfigurationsClient := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(endpoint) - configureAuthFunc(&maintenanceConfigurationsClient.Client) + fleetsClient, err := fleets.NewFleetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Fleets client: %+v", err) + } + configureFunc(fleetsClient.Client) - managedClusterSnapshotsClient := managedclustersnapshots.NewManagedClusterSnapshotsClientWithBaseURI(endpoint) - configureAuthFunc(&managedClusterSnapshotsClient.Client) + maintenanceConfigurationsClient, err := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building MaintenanceConfigurations client: %+v", err) + } + configureFunc(maintenanceConfigurationsClient.Client) - managedClustersClient := managedclusters.NewManagedClustersClientWithBaseURI(endpoint) - configureAuthFunc(&managedClustersClient.Client) + managedClusterSnapshotsClient, err := managedclustersnapshots.NewManagedClusterSnapshotsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ManagedClusterSnapshots client: %+v", err) + } + configureFunc(managedClusterSnapshotsClient.Client) - privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(endpoint) - configureAuthFunc(&privateEndpointConnectionsClient.Client) + managedClustersClient, err := managedclusters.NewManagedClustersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ManagedClusters client: %+v", err) + } + configureFunc(managedClustersClient.Client) - privateLinkResourcesClient := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(endpoint) - configureAuthFunc(&privateLinkResourcesClient.Client) + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) - resolvePrivateLinkServiceIdClient := resolveprivatelinkserviceid.NewResolvePrivateLinkServiceIdClientWithBaseURI(endpoint) - configureAuthFunc(&resolvePrivateLinkServiceIdClient.Client) + privateLinkResourcesClient, err := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkResources client: %+v", err) + } + configureFunc(privateLinkResourcesClient.Client) - snapshotsClient := snapshots.NewSnapshotsClientWithBaseURI(endpoint) - configureAuthFunc(&snapshotsClient.Client) + resolvePrivateLinkServiceIdClient, err := resolveprivatelinkserviceid.NewResolvePrivateLinkServiceIdClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ResolvePrivateLinkServiceId client: %+v", err) + } + configureFunc(resolvePrivateLinkServiceIdClient.Client) - trustedAccessClient := trustedaccess.NewTrustedAccessClientWithBaseURI(endpoint) - configureAuthFunc(&trustedAccessClient.Client) + snapshotsClient, err := snapshots.NewSnapshotsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Snapshots client: %+v", err) + } + configureFunc(snapshotsClient.Client) - return Client{ - AgentPools: &agentPoolsClient, - FleetMembers: &fleetMembersClient, - Fleets: &fleetsClient, - MaintenanceConfigurations: &maintenanceConfigurationsClient, - ManagedClusterSnapshots: &managedClusterSnapshotsClient, - ManagedClusters: &managedClustersClient, - PrivateEndpointConnections: &privateEndpointConnectionsClient, - PrivateLinkResources: &privateLinkResourcesClient, - ResolvePrivateLinkServiceId: &resolvePrivateLinkServiceIdClient, - Snapshots: &snapshotsClient, - TrustedAccess: &trustedAccessClient, + trustedAccessClient, err := trustedaccess.NewTrustedAccessClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building TrustedAccess client: %+v", err) } + configureFunc(trustedAccessClient.Client) + + return &Client{ + AgentPools: agentPoolsClient, + FleetMembers: fleetMembersClient, + Fleets: fleetsClient, + MaintenanceConfigurations: maintenanceConfigurationsClient, + ManagedClusterSnapshots: managedClusterSnapshotsClient, + ManagedClusters: managedClustersClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + PrivateLinkResources: privateLinkResourcesClient, + ResolvePrivateLinkServiceId: resolvePrivateLinkServiceIdClient, + Snapshots: snapshotsClient, + TrustedAccess: trustedAccessClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/client.go index 6b930a99d629..1f2556b87438 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/client.go @@ -1,18 +1,26 @@ package fleetmembers -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 FleetMembersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewFleetMembersClientWithBaseURI(endpoint string) FleetMembersClient { - return FleetMembersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewFleetMembersClientWithBaseURI(sdkApi sdkEnv.Api) (*FleetMembersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "fleetmembers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FleetMembersClient: %+v", err) } + + return &FleetMembersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/constants.go index 4b9b85b42335..e8a926a9d44d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/constants.go @@ -1,6 +1,10 @@ package fleetmembers -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. @@ -27,6 +31,19 @@ func PossibleValuesForFleetMemberProvisioningState() []string { } } +func (s *FleetMemberProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFleetMemberProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFleetMemberProvisioningState(input string) (*FleetMemberProvisioningState, error) { vals := map[string]FleetMemberProvisioningState{ "canceled": FleetMemberProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create.go new file mode 100644 index 000000000000..1a5991834f79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create.go @@ -0,0 +1,107 @@ +package fleetmembers + +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 CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *FleetMember +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Create ... +func (c FleetMembersClient) Create(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 +} + +// CreateThenPoll performs Create then polls until it's completed +func (c FleetMembersClient) CreateThenPoll(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) error { + result, err := c.Create(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create_autorest.go deleted file mode 100644 index e1e8e45f2efd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_create_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package fleetmembers - -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 CreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *FleetMember -} - -type CreateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Create ... -func (c FleetMembersClient) Create(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c FleetMembersClient) CreateThenPoll(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) error { - result, err := c.Create(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c FleetMembersClient) preparerForCreate(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (*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.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c FleetMembersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, 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/containerservice/2022-09-02-preview/fleetmembers/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_delete.go new file mode 100644 index 000000000000..7006a5abe506 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_delete.go @@ -0,0 +1,99 @@ +package fleetmembers + +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 +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c FleetMembersClient) Delete(ctx context.Context, id MemberId, options DeleteOperationOptions) (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(), + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetMembersClient) DeleteThenPoll(ctx context.Context, id MemberId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2022-09-02-preview/fleetmembers/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_delete_autorest.go deleted file mode 100644 index 14e27998d994..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package fleetmembers - -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 -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c FleetMembersClient) Delete(ctx context.Context, id MemberId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FleetMembersClient) DeleteThenPoll(ctx context.Context, id MemberId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 FleetMembersClient) preparerForDelete(ctx context.Context, id MemberId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetMembersClient) 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/containerservice/2022-09-02-preview/fleetmembers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_get.go new file mode 100644 index 000000000000..4ddd179a3b2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_get.go @@ -0,0 +1,51 @@ +package fleetmembers + +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 *FleetMember +} + +// Get ... +func (c FleetMembersClient) Get(ctx context.Context, id MemberId) (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/containerservice/2022-09-02-preview/fleetmembers/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_get_autorest.go deleted file mode 100644 index b73876337c9c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package fleetmembers - -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 *FleetMember -} - -// Get ... -func (c FleetMembersClient) Get(ctx context.Context, id MemberId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FleetMembersClient) preparerForGet(ctx context.Context, id MemberId) (*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 FleetMembersClient) 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/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet.go new file mode 100644 index 000000000000..5347ee738305 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet.go @@ -0,0 +1,91 @@ +package fleetmembers + +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 ListByFleetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]FleetMember +} + +type ListByFleetCompleteResult struct { + LatestHttpResponse *http.Response + Items []FleetMember +} + +// ListByFleet ... +func (c FleetMembersClient) ListByFleet(ctx context.Context, id FleetId) (result ListByFleetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/members", 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 *[]FleetMember `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByFleetComplete retrieves all the results into a single object +func (c FleetMembersClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { + return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetMemberOperationPredicate{}) +} + +// ListByFleetCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetMembersClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetMemberOperationPredicate) (result ListByFleetCompleteResult, err error) { + items := make([]FleetMember, 0) + + resp, err := c.ListByFleet(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 = ListByFleetCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet_autorest.go deleted file mode 100644 index ba31371947ae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/method_listbyfleet_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package fleetmembers - -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 ListByFleetOperationResponse struct { - HttpResponse *http.Response - Model *[]FleetMember - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByFleetOperationResponse, error) -} - -type ListByFleetCompleteResult struct { - Items []FleetMember -} - -func (r ListByFleetOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByFleetOperationResponse) LoadMore(ctx context.Context) (resp ListByFleetOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByFleet ... -func (c FleetMembersClient) ListByFleet(ctx context.Context, id FleetId) (resp ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByFleet(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByFleet prepares the ListByFleet request. -func (c FleetMembersClient) preparerForListByFleet(ctx context.Context, id FleetId) (*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/members", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByFleetWithNextLink prepares the ListByFleet request with the given nextLink token. -func (c FleetMembersClient) preparerForListByFleetWithNextLink(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)) -} - -// responderForListByFleet handles the response to the ListByFleet request. The method always -// closes the http.Response Body. -func (c FleetMembersClient) responderForListByFleet(resp *http.Response) (result ListByFleetOperationResponse, err error) { - type page struct { - Values []FleetMember `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 ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleetWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByFleet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByFleetComplete retrieves all of the results into a single object -func (c FleetMembersClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { - return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetMemberOperationPredicate{}) -} - -// ListByFleetCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetMembersClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetMemberOperationPredicate) (resp ListByFleetCompleteResult, err error) { - items := make([]FleetMember, 0) - - page, err := c.ListByFleet(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 := ListByFleetCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/client.go index db3420827584..199fd2ac0ede 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/client.go @@ -1,18 +1,26 @@ package fleets -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 FleetsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewFleetsClientWithBaseURI(endpoint string) FleetsClient { - return FleetsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewFleetsClientWithBaseURI(sdkApi sdkEnv.Api) (*FleetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "fleets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FleetsClient: %+v", err) } + + return &FleetsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/constants.go index e5112ff1390f..1828806155f5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/constants.go @@ -1,6 +1,10 @@ package fleets -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. @@ -27,6 +31,19 @@ func PossibleValuesForFleetProvisioningState() []string { } } +func (s *FleetProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFleetProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFleetProvisioningState(input string) (*FleetProvisioningState, error) { vals := map[string]FleetProvisioningState{ "canceled": FleetProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate.go new file mode 100644 index 000000000000..1903621e2e57 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate.go @@ -0,0 +1,107 @@ +package fleets + +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 + Model *Fleet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c FleetsClient) CreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 FleetsClient) CreateOrUpdateThenPoll(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/containerservice/2022-09-02-preview/fleets/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate_autorest.go deleted file mode 100644 index 020950bea14c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_createorupdate_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package fleets - -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 - Model *Fleet -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c FleetsClient) CreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c FleetsClient) CreateOrUpdateThenPoll(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - 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 FleetsClient) preparerForCreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (*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.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetsClient) 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/containerservice/2022-09-02-preview/fleets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_delete.go new file mode 100644 index 000000000000..af583413da9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_delete.go @@ -0,0 +1,99 @@ +package fleets + +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 +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c FleetsClient) Delete(ctx context.Context, id FleetId, options DeleteOperationOptions) (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(), + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetsClient) DeleteThenPoll(ctx context.Context, id FleetId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2022-09-02-preview/fleets/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_delete_autorest.go deleted file mode 100644 index 952461b33133..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package fleets - -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 -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c FleetsClient) Delete(ctx context.Context, id FleetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FleetsClient) DeleteThenPoll(ctx context.Context, id FleetId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 FleetsClient) preparerForDelete(ctx context.Context, id FleetId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetsClient) 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/containerservice/2022-09-02-preview/fleets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_get.go new file mode 100644 index 000000000000..76cd8b5fd90f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_get.go @@ -0,0 +1,51 @@ +package fleets + +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 *Fleet +} + +// Get ... +func (c FleetsClient) Get(ctx context.Context, id FleetId) (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/containerservice/2022-09-02-preview/fleets/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_get_autorest.go deleted file mode 100644 index b06413b0122a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package fleets - -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 *Fleet -} - -// Get ... -func (c FleetsClient) Get(ctx context.Context, id FleetId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FleetsClient) preparerForGet(ctx context.Context, id FleetId) (*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 FleetsClient) 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/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup.go new file mode 100644 index 000000000000..34e0ca6a6cb8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package fleets + +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 *[]Fleet +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Fleet +} + +// ListByResourceGroup ... +func (c FleetsClient) 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.ContainerService/fleets", 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 *[]Fleet `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 FleetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FleetOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Fleet, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 39a257a82e75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package fleets - -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 *[]Fleet - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Fleet -} - -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 FleetsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c FleetsClient) 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.ContainerService/fleets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c FleetsClient) 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 FleetsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Fleet `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, "fleets.FleetsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c FleetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FleetOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Fleet, 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/containerservice/2022-09-02-preview/fleets/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription.go new file mode 100644 index 000000000000..b8af61b449c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription.go @@ -0,0 +1,92 @@ +package fleets + +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 *[]Fleet +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []Fleet +} + +// ListBySubscription ... +func (c FleetsClient) 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.ContainerService/fleets", 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 *[]Fleet `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 FleetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FleetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Fleet, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription_autorest.go deleted file mode 100644 index 4139ce3d5ef9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package fleets - -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 *[]Fleet - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []Fleet -} - -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 FleetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c FleetsClient) 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.ContainerService/fleets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c FleetsClient) 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 FleetsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []Fleet `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, "fleets.FleetsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c FleetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FleetOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]Fleet, 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/containerservice/2022-09-02-preview/fleets/method_listcredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listcredentials.go new file mode 100644 index 000000000000..6687ee3d8b19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listcredentials.go @@ -0,0 +1,52 @@ +package fleets + +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 ListCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FleetCredentialResults +} + +// ListCredentials ... +func (c FleetsClient) ListCredentials(ctx context.Context, id FleetId) (result ListCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listCredentials", 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/containerservice/2022-09-02-preview/fleets/method_listcredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listcredentials_autorest.go deleted file mode 100644 index 2555b09c591d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_listcredentials_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package fleets - -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 ListCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *FleetCredentialResults -} - -// ListCredentials ... -func (c FleetsClient) ListCredentials(ctx context.Context, id FleetId) (result ListCredentialsOperationResponse, err error) { - req, err := c.preparerForListCredentials(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListCredentials prepares the ListCredentials request. -func (c FleetsClient) preparerForListCredentials(ctx context.Context, id FleetId) (*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/listCredentials", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListCredentials handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (c FleetsClient) responderForListCredentials(resp *http.Response) (result ListCredentialsOperationResponse, 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/containerservice/2022-09-02-preview/fleets/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_update.go new file mode 100644 index 000000000000..cfc790434700 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_update.go @@ -0,0 +1,84 @@ +package fleets + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Fleet +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c FleetsClient) Update(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + 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/containerservice/2022-09-02-preview/fleets/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_update_autorest.go deleted file mode 100644 index 74d777c03169..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleets/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package fleets - -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 *Fleet -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c FleetsClient) Update(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c FleetsClient) preparerForUpdate(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (*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.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetsClient) 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/containerservice/2022-09-02-preview/maintenanceconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/client.go index c955dc01ae80..4d799de617cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/client.go @@ -1,18 +1,26 @@ package maintenanceconfigurations -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 MaintenanceConfigurationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewMaintenanceConfigurationsClientWithBaseURI(endpoint string) MaintenanceConfigurationsClient { - return MaintenanceConfigurationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewMaintenanceConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*MaintenanceConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "maintenanceconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MaintenanceConfigurationsClient: %+v", err) } + + return &MaintenanceConfigurationsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/constants.go index 7cc6e211d5c3..5de31c62f8dd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/constants.go @@ -1,6 +1,10 @@ package maintenanceconfigurations -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 PossibleValuesForWeekDay() []string { } } +func (s *WeekDay) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWeekDay(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWeekDay(input string) (*WeekDay, error) { vals := map[string]WeekDay{ "friday": WeekDayFriday, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate.go new file mode 100644 index 000000000000..884829064800 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate.go @@ -0,0 +1,55 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// CreateOrUpdate ... +func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (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/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go deleted file mode 100644 index 57eb1a03ef4b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// CreateOrUpdate ... -func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c MaintenanceConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*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 MaintenanceConfigurationsClient) 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/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete.go new file mode 100644 index 000000000000..5993be4c15a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete.go @@ -0,0 +1,47 @@ +package maintenanceconfigurations + +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 MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (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/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete_autorest.go deleted file mode 100644 index 27bc6b8c8559..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package maintenanceconfigurations - -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 MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c MaintenanceConfigurationsClient) preparerForDelete(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get.go new file mode 100644 index 000000000000..9a6e4324c68e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get.go @@ -0,0 +1,51 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// Get ... +func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (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/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get_autorest.go deleted file mode 100644 index 57a6eb55e01d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// Get ... -func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c MaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go new file mode 100644 index 000000000000..dae38e858212 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go @@ -0,0 +1,92 @@ +package maintenanceconfigurations + +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 ListByManagedClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]MaintenanceConfiguration +} + +type ListByManagedClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []MaintenanceConfiguration +} + +// ListByManagedCluster ... +func (c MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (result ListByManagedClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/maintenanceConfigurations", 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 *[]MaintenanceConfiguration `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByManagedClusterComplete retrieves all the results into a single object +func (c MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListByManagedClusterCompleteResult, error) { + return c.ListByManagedClusterCompleteMatchingPredicate(ctx, id, MaintenanceConfigurationOperationPredicate{}) +} + +// ListByManagedClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MaintenanceConfigurationsClient) ListByManagedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MaintenanceConfigurationOperationPredicate) (result ListByManagedClusterCompleteResult, err error) { + items := make([]MaintenanceConfiguration, 0) + + resp, err := c.ListByManagedCluster(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 = ListByManagedClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go deleted file mode 100644 index 7463165baacd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package maintenanceconfigurations - -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 ListByManagedClusterOperationResponse struct { - HttpResponse *http.Response - Model *[]MaintenanceConfiguration - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByManagedClusterOperationResponse, error) -} - -type ListByManagedClusterCompleteResult struct { - Items []MaintenanceConfiguration -} - -func (r ListByManagedClusterOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByManagedClusterOperationResponse) LoadMore(ctx context.Context) (resp ListByManagedClusterOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByManagedCluster ... -func (c MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (resp ListByManagedClusterOperationResponse, err error) { - req, err := c.preparerForListByManagedCluster(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByManagedCluster(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByManagedCluster prepares the ListByManagedCluster request. -func (c MaintenanceConfigurationsClient) preparerForListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (*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/maintenanceConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByManagedClusterWithNextLink prepares the ListByManagedCluster request with the given nextLink token. -func (c MaintenanceConfigurationsClient) preparerForListByManagedClusterWithNextLink(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)) -} - -// responderForListByManagedCluster handles the response to the ListByManagedCluster request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForListByManagedCluster(resp *http.Response) (result ListByManagedClusterOperationResponse, err error) { - type page struct { - Values []MaintenanceConfiguration `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 ListByManagedClusterOperationResponse, err error) { - req, err := c.preparerForListByManagedClusterWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByManagedCluster(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByManagedClusterComplete retrieves all of the results into a single object -func (c MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListByManagedClusterCompleteResult, error) { - return c.ListByManagedClusterCompleteMatchingPredicate(ctx, id, MaintenanceConfigurationOperationPredicate{}) -} - -// ListByManagedClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MaintenanceConfigurationsClient) ListByManagedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MaintenanceConfigurationOperationPredicate) (resp ListByManagedClusterCompleteResult, err error) { - items := make([]MaintenanceConfiguration, 0) - - page, err := c.ListByManagedCluster(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 := ListByManagedClusterCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/client.go index df94ecc4199e..5081c63c8e61 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/client.go @@ -1,18 +1,26 @@ package managedclusters -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 ManagedClustersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedClustersClientWithBaseURI(endpoint string) ManagedClustersClient { - return ManagedClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedClustersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedClustersClient: %+v", err) } + + return &ManagedClustersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/constants.go index 10f37cc8655d..c31620912004 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/constants.go @@ -1,6 +1,10 @@ package managedclusters -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 PossibleValuesForAgentPoolMode() []string { } } +func (s *AgentPoolMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolMode(input string) (*AgentPoolMode, error) { vals := map[string]AgentPoolMode{ "system": AgentPoolModeSystem, @@ -47,6 +64,19 @@ func PossibleValuesForAgentPoolType() []string { } } +func (s *AgentPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolType(input string) (*AgentPoolType, error) { vals := map[string]AgentPoolType{ "availabilityset": AgentPoolTypeAvailabilitySet, @@ -75,6 +105,19 @@ func PossibleValuesForBackendPoolType() []string { } } +func (s *BackendPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBackendPoolType(input string) (*BackendPoolType, error) { vals := map[string]BackendPoolType{ "nodeip": BackendPoolTypeNodeIP, @@ -103,6 +146,19 @@ func PossibleValuesForCode() []string { } } +func (s *Code) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCode(input string) (*Code, error) { vals := map[string]Code{ "running": CodeRunning, @@ -131,6 +187,19 @@ func PossibleValuesForControlledValues() []string { } } +func (s *ControlledValues) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseControlledValues(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseControlledValues(input string) (*ControlledValues, error) { vals := map[string]ControlledValues{ "requestsandlimits": ControlledValuesRequestsAndLimits, @@ -157,6 +226,19 @@ func PossibleValuesForEbpfDataplane() []string { } } +func (s *EbpfDataplane) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEbpfDataplane(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseEbpfDataplane(input string) (*EbpfDataplane, error) { vals := map[string]EbpfDataplane{ "cilium": EbpfDataplaneCilium, @@ -188,6 +270,19 @@ func PossibleValuesForExpander() []string { } } +func (s *Expander) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpander(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseExpander(input string) (*Expander, error) { vals := map[string]Expander{ "least-waste": ExpanderLeastNegativewaste, @@ -218,6 +313,19 @@ func PossibleValuesForFormat() []string { } } +func (s *Format) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFormat(input string) (*Format, error) { vals := map[string]Format{ "azure": FormatAzure, @@ -252,6 +360,19 @@ func PossibleValuesForGPUInstanceProfile() []string { } } +func (s *GPUInstanceProfile) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGPUInstanceProfile(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGPUInstanceProfile(input string) (*GPUInstanceProfile, error) { vals := map[string]GPUInstanceProfile{ "mig4g": GPUInstanceProfileMIGFourg, @@ -283,6 +404,19 @@ func PossibleValuesForIPFamily() []string { } } +func (s *IPFamily) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPFamily(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIPFamily(input string) (*IPFamily, error) { vals := map[string]IPFamily{ "ipv4": IPFamilyIPvFour, @@ -311,6 +445,19 @@ func PossibleValuesForIPvsScheduler() []string { } } +func (s *IPvsScheduler) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPvsScheduler(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIPvsScheduler(input string) (*IPvsScheduler, error) { vals := map[string]IPvsScheduler{ "leastconnection": IPvsSchedulerLeastConnection, @@ -339,6 +486,19 @@ func PossibleValuesForKeyVaultNetworkAccessTypes() []string { } } +func (s *KeyVaultNetworkAccessTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyVaultNetworkAccessTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyVaultNetworkAccessTypes(input string) (*KeyVaultNetworkAccessTypes, error) { vals := map[string]KeyVaultNetworkAccessTypes{ "private": KeyVaultNetworkAccessTypesPrivate, @@ -367,6 +527,19 @@ func PossibleValuesForKubeletDiskType() []string { } } +func (s *KubeletDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubeletDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubeletDiskType(input string) (*KubeletDiskType, error) { vals := map[string]KubeletDiskType{ "os": KubeletDiskTypeOS, @@ -397,6 +570,19 @@ func PossibleValuesForLevel() []string { } } +func (s *Level) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLevel(input string) (*Level, error) { vals := map[string]Level{ "enforcement": LevelEnforcement, @@ -426,6 +612,19 @@ func PossibleValuesForLicenseType() []string { } } +func (s *LicenseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLicenseType(input string) (*LicenseType, error) { vals := map[string]LicenseType{ "none": LicenseTypeNone, @@ -454,6 +653,19 @@ func PossibleValuesForLoadBalancerSku() []string { } } +func (s *LoadBalancerSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoadBalancerSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoadBalancerSku(input string) (*LoadBalancerSku, error) { vals := map[string]LoadBalancerSku{ "basic": LoadBalancerSkuBasic, @@ -486,6 +698,19 @@ func PossibleValuesForManagedClusterPodIdentityProvisioningState() []string { } } +func (s *ManagedClusterPodIdentityProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterPodIdentityProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterPodIdentityProvisioningState(input string) (*ManagedClusterPodIdentityProvisioningState, error) { vals := map[string]ManagedClusterPodIdentityProvisioningState{ "assigned": ManagedClusterPodIdentityProvisioningStateAssigned, @@ -514,6 +739,19 @@ func PossibleValuesForManagedClusterSKUName() []string { } } +func (s *ManagedClusterSKUName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUName(input string) (*ManagedClusterSKUName, error) { vals := map[string]ManagedClusterSKUName{ "basic": ManagedClusterSKUNameBasic, @@ -541,6 +779,19 @@ func PossibleValuesForManagedClusterSKUTier() []string { } } +func (s *ManagedClusterSKUTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUTier(input string) (*ManagedClusterSKUTier, error) { vals := map[string]ManagedClusterSKUTier{ "free": ManagedClusterSKUTierFree, @@ -569,6 +820,19 @@ func PossibleValuesForMode() []string { } } +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMode(input string) (*Mode, error) { vals := map[string]Mode{ "iptables": ModeIPTABLES, @@ -597,6 +861,19 @@ func PossibleValuesForNetworkMode() []string { } } +func (s *NetworkMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkMode(input string) (*NetworkMode, error) { vals := map[string]NetworkMode{ "bridge": NetworkModeBridge, @@ -627,6 +904,19 @@ func PossibleValuesForNetworkPlugin() []string { } } +func (s *NetworkPlugin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPlugin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPlugin(input string) (*NetworkPlugin, error) { vals := map[string]NetworkPlugin{ "azure": NetworkPluginAzure, @@ -654,6 +944,19 @@ func PossibleValuesForNetworkPluginMode() []string { } } +func (s *NetworkPluginMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPluginMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPluginMode(input string) (*NetworkPluginMode, error) { vals := map[string]NetworkPluginMode{ "overlay": NetworkPluginModeOverlay, @@ -681,6 +984,19 @@ func PossibleValuesForNetworkPolicy() []string { } } +func (s *NetworkPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPolicy(input string) (*NetworkPolicy, error) { vals := map[string]NetworkPolicy{ "azure": NetworkPolicyAzure, @@ -709,6 +1025,19 @@ func PossibleValuesForOSDiskType() []string { } } +func (s *OSDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSDiskType(input string) (*OSDiskType, error) { vals := map[string]OSDiskType{ "ephemeral": OSDiskTypeEphemeral, @@ -743,6 +1072,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "cblmariner": OSSKUCBLMariner, @@ -774,6 +1116,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -806,6 +1161,19 @@ func PossibleValuesForOutboundType() []string { } } +func (s *OutboundType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOutboundType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOutboundType(input string) (*OutboundType, error) { vals := map[string]OutboundType{ "loadbalancer": OutboundTypeLoadBalancer, @@ -836,6 +1204,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTCP, @@ -866,6 +1247,19 @@ func PossibleValuesForPublicNetworkAccess() []string { } } +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { vals := map[string]PublicNetworkAccess{ "disabled": PublicNetworkAccessDisabled, @@ -895,6 +1289,19 @@ func PossibleValuesForScaleDownMode() []string { } } +func (s *ScaleDownMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleDownMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleDownMode(input string) (*ScaleDownMode, error) { vals := map[string]ScaleDownMode{ "deallocate": ScaleDownModeDeallocate, @@ -923,6 +1330,19 @@ func PossibleValuesForScaleSetEvictionPolicy() []string { } } +func (s *ScaleSetEvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetEvictionPolicy(input string) (*ScaleSetEvictionPolicy, error) { vals := map[string]ScaleSetEvictionPolicy{ "deallocate": ScaleSetEvictionPolicyDeallocate, @@ -951,6 +1371,19 @@ func PossibleValuesForScaleSetPriority() []string { } } +func (s *ScaleSetPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetPriority(input string) (*ScaleSetPriority, error) { vals := map[string]ScaleSetPriority{ "regular": ScaleSetPriorityRegular, @@ -983,6 +1416,19 @@ func PossibleValuesForUpdateMode() []string { } } +func (s *UpdateMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpdateMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpdateMode(input string) (*UpdateMode, error) { vals := map[string]UpdateMode{ "auto": UpdateModeAuto, @@ -1019,6 +1465,19 @@ func PossibleValuesForUpgradeChannel() []string { } } +func (s *UpgradeChannel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeChannel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpgradeChannel(input string) (*UpgradeChannel, error) { vals := map[string]UpgradeChannel{ "node-image": UpgradeChannelNodeNegativeimage, @@ -1050,6 +1509,19 @@ func PossibleValuesForWorkloadRuntime() []string { } } +func (s *WorkloadRuntime) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadRuntime(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWorkloadRuntime(input string) (*WorkloadRuntime, error) { vals := map[string]WorkloadRuntime{ "ocicontainer": WorkloadRuntimeOCIContainer, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation.go new file mode 100644 index 000000000000..635c6bcc2aba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation.go @@ -0,0 +1,48 @@ +package managedclusters + +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 AbortLatestOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// AbortLatestOperation ... +func (c ManagedClustersClient) AbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (result AbortLatestOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/abort", 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/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation_autorest.go deleted file mode 100644 index 02061733da9f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_abortlatestoperation_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 AbortLatestOperationOperationResponse struct { - HttpResponse *http.Response -} - -// AbortLatestOperation ... -func (c ManagedClustersClient) AbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (result AbortLatestOperationOperationResponse, err error) { - req, err := c.preparerForAbortLatestOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAbortLatestOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAbortLatestOperation prepares the AbortLatestOperation request. -func (c ManagedClustersClient) preparerForAbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (*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/abort", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAbortLatestOperation handles the response to the AbortLatestOperation request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForAbortLatestOperation(resp *http.Response) (result AbortLatestOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate.go new file mode 100644 index 000000000000..c32d75d0be9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate.go @@ -0,0 +1,76 @@ +package managedclusters + +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/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 + Model *ManagedCluster +} + +// CreateOrUpdate ... +func (c ManagedClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) 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/containerservice/2022-09-02-preview/managedclusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate_autorest.go deleted file mode 100644 index 3a39a0803554..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_createorupdate_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *ManagedCluster -} - -// CreateOrUpdate ... -func (c ManagedClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ManagedClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) 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 ManagedClustersClient) preparerForCreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (*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 ManagedClustersClient) 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/containerservice/2022-09-02-preview/managedclusters/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_delete.go new file mode 100644 index 000000000000..53bf6a9ac7c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_delete.go @@ -0,0 +1,99 @@ +package managedclusters + +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/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 +} + +type DeleteOperationOptions struct { + IgnorePodDisruptionBudget *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IgnorePodDisruptionBudget != nil { + out.Append("ignore-pod-disruption-budget", fmt.Sprintf("%v", *o.IgnorePodDisruptionBudget)) + } + return &out +} + +// Delete ... +func (c ManagedClustersClient) Delete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2022-09-02-preview/managedclusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_delete_autorest.go deleted file mode 100644 index b6a15e70f3bd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_delete_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package managedclusters - -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" - "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 DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IgnorePodDisruptionBudget *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IgnorePodDisruptionBudget != nil { - out["ignore-pod-disruption-budget"] = *o.IgnorePodDisruptionBudget - } - - return out -} - -// Delete ... -func (c ManagedClustersClient) Delete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ManagedClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 ManagedClustersClient) preparerForDelete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 ManagedClustersClient) 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/containerservice/2022-09-02-preview/managedclusters/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_get.go new file mode 100644 index 000000000000..fe45d85e520e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_get.go @@ -0,0 +1,52 @@ +package managedclusters + +import ( + "context" + "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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// Get ... +func (c ManagedClustersClient) Get(ctx context.Context, id commonids.KubernetesClusterId) (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/containerservice/2022-09-02-preview/managedclusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_get_autorest.go deleted file mode 100644 index dd792998fed2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -import ( - "context" - "net/http" - - "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 GetOperationResponse struct { - HttpResponse *http.Response - Model *ManagedCluster -} - -// Get ... -func (c ManagedClustersClient) Get(ctx context.Context, id commonids.KubernetesClusterId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClustersClient) preparerForGet(ctx context.Context, id commonids.KubernetesClusterId) (*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 ManagedClustersClient) 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/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile.go new file mode 100644 index 000000000000..3aef3b2c7135 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile.go @@ -0,0 +1,52 @@ +package managedclusters + +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 GetAccessProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterAccessProfile +} + +// GetAccessProfile ... +func (c ManagedClustersClient) GetAccessProfile(ctx context.Context, id AccessProfileId) (result GetAccessProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listCredential", 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/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile_autorest.go deleted file mode 100644 index 82b7df70d16e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getaccessprofile_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -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 GetAccessProfileOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterAccessProfile -} - -// GetAccessProfile ... -func (c ManagedClustersClient) GetAccessProfile(ctx context.Context, id AccessProfileId) (result GetAccessProfileOperationResponse, err error) { - req, err := c.preparerForGetAccessProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAccessProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAccessProfile prepares the GetAccessProfile request. -func (c ManagedClustersClient) preparerForGetAccessProfile(ctx context.Context, id AccessProfileId) (*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/listCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAccessProfile handles the response to the GetAccessProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetAccessProfile(resp *http.Response) (result GetAccessProfileOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult.go new file mode 100644 index 000000000000..f1bd0c65255d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult.go @@ -0,0 +1,52 @@ +package managedclusters + +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 GetCommandResultOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// GetCommandResult ... +func (c ManagedClustersClient) GetCommandResult(ctx context.Context, id CommandResultId) (result GetCommandResultOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult_autorest.go deleted file mode 100644 index b5d9f095c1eb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getcommandresult_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclusters - -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 GetCommandResultOperationResponse struct { - HttpResponse *http.Response - Model *RunCommandResult -} - -// GetCommandResult ... -func (c ManagedClustersClient) GetCommandResult(ctx context.Context, id CommandResultId) (result GetCommandResultOperationResponse, err error) { - req, err := c.preparerForGetCommandResult(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetCommandResult(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetCommandResult prepares the GetCommandResult request. -func (c ManagedClustersClient) preparerForGetCommandResult(ctx context.Context, id CommandResultId) (*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)) -} - -// responderForGetCommandResult handles the response to the GetCommandResult request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetCommandResult(resp *http.Response) (result GetCommandResultOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions.go new file mode 100644 index 000000000000..88fd5581bc89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions.go @@ -0,0 +1,80 @@ +package managedclusters + +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 GetOSOptionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OSOptionProfile +} + +type GetOSOptionsOperationOptions struct { + ResourceType *string +} + +func DefaultGetOSOptionsOperationOptions() GetOSOptionsOperationOptions { + return GetOSOptionsOperationOptions{} +} + +func (o GetOSOptionsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOSOptionsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOSOptionsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ResourceType != nil { + out.Append("resource-type", fmt.Sprintf("%v", *o.ResourceType)) + } + return &out +} + +// GetOSOptions ... +func (c ManagedClustersClient) GetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (result GetOSOptionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/osOptions/default", 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/containerservice/2022-09-02-preview/managedclusters/method_getosoptions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions_autorest.go deleted file mode 100644 index 59f01e6d53f8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getosoptions_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package managedclusters - -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 GetOSOptionsOperationResponse struct { - HttpResponse *http.Response - Model *OSOptionProfile -} - -type GetOSOptionsOperationOptions struct { - ResourceType *string -} - -func DefaultGetOSOptionsOperationOptions() GetOSOptionsOperationOptions { - return GetOSOptionsOperationOptions{} -} - -func (o GetOSOptionsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOSOptionsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ResourceType != nil { - out["resource-type"] = *o.ResourceType - } - - return out -} - -// GetOSOptions ... -func (c ManagedClustersClient) GetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (result GetOSOptionsOperationResponse, err error) { - req, err := c.preparerForGetOSOptions(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetOSOptions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetOSOptions prepares the GetOSOptions request. -func (c ManagedClustersClient) preparerForGetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (*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/osOptions/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetOSOptions handles the response to the GetOSOptions request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetOSOptions(resp *http.Response) (result GetOSOptionsOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile.go new file mode 100644 index 000000000000..52c89ae8d473 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile.go @@ -0,0 +1,53 @@ +package managedclusters + +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 GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterUpgradeProfile +} + +// GetUpgradeProfile ... +func (c ManagedClustersClient) GetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/upgradeProfiles/default", 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/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile_autorest.go deleted file mode 100644 index cd10c7215b92..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_getupgradeprofile_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 GetUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterUpgradeProfile -} - -// GetUpgradeProfile ... -func (c ManagedClustersClient) GetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (result GetUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetUpgradeProfile prepares the GetUpgradeProfile request. -func (c ManagedClustersClient) preparerForGetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (*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/upgradeProfiles/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetUpgradeProfile handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetUpgradeProfile(resp *http.Response) (result GetUpgradeProfileOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list.go new file mode 100644 index 000000000000..17fb5e8fb680 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ManagedCluster +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// List ... +func (c ManagedClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/managedClusters", 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 *[]ManagedCluster `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 ManagedClustersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list_autorest.go deleted file mode 100644 index 871409d1963c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ManagedCluster -} - -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) -} - -// List ... -func (c ManagedClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ManagedClustersClient) preparerForList(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.ContainerService/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ManagedClustersClient) 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 ManagedClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedclusters.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ManagedCluster, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup.go new file mode 100644 index 000000000000..ee4658b5e0f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedclusters + +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 *[]ManagedCluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// ListByResourceGroup ... +func (c ManagedClustersClient) 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.ContainerService/managedClusters", 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 *[]ManagedCluster `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 ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedCluster, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup_autorest.go deleted file mode 100644 index bc961d43758e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedCluster -} - -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 ManagedClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClustersClient) 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.ContainerService/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClustersClient) 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 ManagedClustersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedclusters.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedCluster, 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/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials.go new file mode 100644 index 000000000000..1327fd22ff5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials.go @@ -0,0 +1,81 @@ +package managedclusters + +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 ListClusterAdminCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterAdminCredentialsOperationOptions struct { + ServerFqdn *string +} + +func DefaultListClusterAdminCredentialsOperationOptions() ListClusterAdminCredentialsOperationOptions { + return ListClusterAdminCredentialsOperationOptions{} +} + +func (o ListClusterAdminCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterAdminCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterAdminCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterAdminCredentials ... +func (c ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (result ListClusterAdminCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterAdminCredential", 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/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go deleted file mode 100644 index f8024c5b3075..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterAdminCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterAdminCredentialsOperationOptions struct { - ServerFqdn *string -} - -func DefaultListClusterAdminCredentialsOperationOptions() ListClusterAdminCredentialsOperationOptions { - return ListClusterAdminCredentialsOperationOptions{} -} - -func (o ListClusterAdminCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterAdminCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterAdminCredentials ... -func (c ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (result ListClusterAdminCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterAdminCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterAdminCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterAdminCredentials prepares the ListClusterAdminCredentials request. -func (c ManagedClustersClient) preparerForListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterAdminCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterAdminCredentials handles the response to the ListClusterAdminCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterAdminCredentials(resp *http.Response) (result ListClusterAdminCredentialsOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials.go new file mode 100644 index 000000000000..06110ff0a0f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials.go @@ -0,0 +1,81 @@ +package managedclusters + +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 ListClusterMonitoringUserCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterMonitoringUserCredentialsOperationOptions struct { + ServerFqdn *string +} + +func DefaultListClusterMonitoringUserCredentialsOperationOptions() ListClusterMonitoringUserCredentialsOperationOptions { + return ListClusterMonitoringUserCredentialsOperationOptions{} +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterMonitoringUserCredentials ... +func (c ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (result ListClusterMonitoringUserCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterMonitoringUserCredential", 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/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go deleted file mode 100644 index a7f62d3aff19..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterMonitoringUserCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterMonitoringUserCredentialsOperationOptions struct { - ServerFqdn *string -} - -func DefaultListClusterMonitoringUserCredentialsOperationOptions() ListClusterMonitoringUserCredentialsOperationOptions { - return ListClusterMonitoringUserCredentialsOperationOptions{} -} - -func (o ListClusterMonitoringUserCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterMonitoringUserCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterMonitoringUserCredentials ... -func (c ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (result ListClusterMonitoringUserCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterMonitoringUserCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterMonitoringUserCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterMonitoringUserCredentials prepares the ListClusterMonitoringUserCredentials request. -func (c ManagedClustersClient) preparerForListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterMonitoringUserCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterMonitoringUserCredentials handles the response to the ListClusterMonitoringUserCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterMonitoringUserCredentials(resp *http.Response) (result ListClusterMonitoringUserCredentialsOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials.go new file mode 100644 index 000000000000..e12b97e5b93f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials.go @@ -0,0 +1,85 @@ +package managedclusters + +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 ListClusterUserCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterUserCredentialsOperationOptions struct { + Format *Format + ServerFqdn *string +} + +func DefaultListClusterUserCredentialsOperationOptions() ListClusterUserCredentialsOperationOptions { + return ListClusterUserCredentialsOperationOptions{} +} + +func (o ListClusterUserCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterUserCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterUserCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterUserCredentials ... +func (c ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (result ListClusterUserCredentialsOperationResponse, 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()), + 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/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials_autorest.go deleted file mode 100644 index 0c90a5488c66..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listclusterusercredentials_autorest.go +++ /dev/null @@ -1,104 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterUserCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterUserCredentialsOperationOptions struct { - Format *Format - ServerFqdn *string -} - -func DefaultListClusterUserCredentialsOperationOptions() ListClusterUserCredentialsOperationOptions { - return ListClusterUserCredentialsOperationOptions{} -} - -func (o ListClusterUserCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterUserCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterUserCredentials ... -func (c ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (result ListClusterUserCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterUserCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterUserCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterUserCredentials prepares the ListClusterUserCredentials request. -func (c ManagedClustersClient) preparerForListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterUserCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterUserCredentials handles the response to the ListClusterUserCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterUserCredentials(resp *http.Response) (result ListClusterUserCredentialsOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go new file mode 100644 index 000000000000..759383196b88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OutboundEnvironmentEndpoint +} + +type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { + LatestHttpResponse *http.Response + Items []OutboundEnvironmentEndpoint +} + +// ListOutboundNetworkDependenciesEndpoints ... +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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 +} + +// ListOutboundNetworkDependenciesEndpointsComplete retrieves all the results into a single object +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate OutboundEnvironmentEndpointOperationPredicate) (result ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + resp, err := c.ListOutboundNetworkDependenciesEndpoints(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 = ListOutboundNetworkDependenciesEndpointsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go deleted file mode 100644 index c3db60df9284..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { - HttpResponse *http.Response - Model *[]OutboundEnvironmentEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOutboundNetworkDependenciesEndpointsOperationResponse, error) -} - -type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { - Items []OutboundEnvironmentEndpoint -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListOutboundNetworkDependenciesEndpoints ... -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListOutboundNetworkDependenciesEndpoints prepares the ListOutboundNetworkDependenciesEndpoints request. -func (c ManagedClustersClient) preparerForListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (*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)) -} - -// preparerForListOutboundNetworkDependenciesEndpointsWithNextLink prepares the ListOutboundNetworkDependenciesEndpoints request with the given nextLink token. -func (c ManagedClustersClient) preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(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)) -} - -// responderForListOutboundNetworkDependenciesEndpoints handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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 ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListOutboundNetworkDependenciesEndpoints(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { - return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) -} - -// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { - items := make([]OutboundEnvironmentEndpoint, 0) - - page, err := c.ListOutboundNetworkDependenciesEndpoints(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 := ListOutboundNetworkDependenciesEndpointsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile.go new file mode 100644 index 000000000000..abdbb59c0189 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 ResetAADProfileOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ResetAADProfile ... +func (c ManagedClustersClient) ResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (result ResetAADProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resetAADProfile", 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 +} + +// ResetAADProfileThenPoll performs ResetAADProfile then polls until it's completed +func (c ManagedClustersClient) ResetAADProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) error { + result, err := c.ResetAADProfile(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ResetAADProfile: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ResetAADProfile: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile_autorest.go deleted file mode 100644 index 5c43129a602b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetaadprofile_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedclusters - -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" - "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 ResetAADProfileOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ResetAADProfile ... -func (c ManagedClustersClient) ResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (result ResetAADProfileOperationResponse, err error) { - req, err := c.preparerForResetAADProfile(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") - return - } - - result, err = c.senderForResetAADProfile(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetAADProfile", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetAADProfileThenPoll performs ResetAADProfile then polls until it's completed -func (c ManagedClustersClient) ResetAADProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) error { - result, err := c.ResetAADProfile(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ResetAADProfile: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ResetAADProfile: %+v", err) - } - - return nil -} - -// preparerForResetAADProfile prepares the ResetAADProfile request. -func (c ManagedClustersClient) preparerForResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (*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/resetAADProfile", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResetAADProfile sends the ResetAADProfile request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForResetAADProfile(ctx context.Context, req *http.Request) (future ResetAADProfileOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile.go new file mode 100644 index 000000000000..54589acaf039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 ResetServicePrincipalProfileOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ResetServicePrincipalProfile ... +func (c ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (result ResetServicePrincipalProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resetServicePrincipalProfile", 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 +} + +// ResetServicePrincipalProfileThenPoll performs ResetServicePrincipalProfile then polls until it's completed +func (c ManagedClustersClient) ResetServicePrincipalProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) error { + result, err := c.ResetServicePrincipalProfile(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ResetServicePrincipalProfile: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ResetServicePrincipalProfile: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go deleted file mode 100644 index 874e24031409..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedclusters - -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" - "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 ResetServicePrincipalProfileOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ResetServicePrincipalProfile ... -func (c ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (result ResetServicePrincipalProfileOperationResponse, err error) { - req, err := c.preparerForResetServicePrincipalProfile(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") - return - } - - result, err = c.senderForResetServicePrincipalProfile(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetServicePrincipalProfile", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetServicePrincipalProfileThenPoll performs ResetServicePrincipalProfile then polls until it's completed -func (c ManagedClustersClient) ResetServicePrincipalProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) error { - result, err := c.ResetServicePrincipalProfile(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ResetServicePrincipalProfile: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ResetServicePrincipalProfile: %+v", err) - } - - return nil -} - -// preparerForResetServicePrincipalProfile prepares the ResetServicePrincipalProfile request. -func (c ManagedClustersClient) preparerForResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (*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/resetServicePrincipalProfile", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResetServicePrincipalProfile sends the ResetServicePrincipalProfile request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForResetServicePrincipalProfile(ctx context.Context, req *http.Request) (future ResetServicePrincipalProfileOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates.go new file mode 100644 index 000000000000..3d04938f645d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 RotateClusterCertificatesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RotateClusterCertificates ... +func (c ManagedClustersClient) RotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (result RotateClusterCertificatesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rotateClusterCertificates", 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 +} + +// RotateClusterCertificatesThenPoll performs RotateClusterCertificates then polls until it's completed +func (c ManagedClustersClient) RotateClusterCertificatesThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.RotateClusterCertificates(ctx, id) + if err != nil { + return fmt.Errorf("performing RotateClusterCertificates: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RotateClusterCertificates: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates_autorest.go deleted file mode 100644 index 3dbf6a18a04e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateclustercertificates_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 RotateClusterCertificatesOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RotateClusterCertificates ... -func (c ManagedClustersClient) RotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (result RotateClusterCertificatesOperationResponse, err error) { - req, err := c.preparerForRotateClusterCertificates(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") - return - } - - result, err = c.senderForRotateClusterCertificates(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateClusterCertificates", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RotateClusterCertificatesThenPoll performs RotateClusterCertificates then polls until it's completed -func (c ManagedClustersClient) RotateClusterCertificatesThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.RotateClusterCertificates(ctx, id) - if err != nil { - return fmt.Errorf("performing RotateClusterCertificates: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RotateClusterCertificates: %+v", err) - } - - return nil -} - -// preparerForRotateClusterCertificates prepares the RotateClusterCertificates request. -func (c ManagedClustersClient) preparerForRotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (*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/rotateClusterCertificates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRotateClusterCertificates sends the RotateClusterCertificates request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRotateClusterCertificates(ctx context.Context, req *http.Request) (future RotateClusterCertificatesOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go new file mode 100644 index 000000000000..b4cecc16d857 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 RotateServiceAccountSigningKeysOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RotateServiceAccountSigningKeys ... +func (c ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (result RotateServiceAccountSigningKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rotateServiceAccountSigningKeys", 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 +} + +// RotateServiceAccountSigningKeysThenPoll performs RotateServiceAccountSigningKeys then polls until it's completed +func (c ManagedClustersClient) RotateServiceAccountSigningKeysThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.RotateServiceAccountSigningKeys(ctx, id) + if err != nil { + return fmt.Errorf("performing RotateServiceAccountSigningKeys: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RotateServiceAccountSigningKeys: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go deleted file mode 100644 index d0806cb35c67..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 RotateServiceAccountSigningKeysOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RotateServiceAccountSigningKeys ... -func (c ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (result RotateServiceAccountSigningKeysOperationResponse, err error) { - req, err := c.preparerForRotateServiceAccountSigningKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateServiceAccountSigningKeys", nil, "Failure preparing request") - return - } - - result, err = c.senderForRotateServiceAccountSigningKeys(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateServiceAccountSigningKeys", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RotateServiceAccountSigningKeysThenPoll performs RotateServiceAccountSigningKeys then polls until it's completed -func (c ManagedClustersClient) RotateServiceAccountSigningKeysThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.RotateServiceAccountSigningKeys(ctx, id) - if err != nil { - return fmt.Errorf("performing RotateServiceAccountSigningKeys: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RotateServiceAccountSigningKeys: %+v", err) - } - - return nil -} - -// preparerForRotateServiceAccountSigningKeys prepares the RotateServiceAccountSigningKeys request. -func (c ManagedClustersClient) preparerForRotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (*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/rotateServiceAccountSigningKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRotateServiceAccountSigningKeys sends the RotateServiceAccountSigningKeys request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRotateServiceAccountSigningKeys(ctx context.Context, req *http.Request) (future RotateServiceAccountSigningKeysOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_runcommand.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand.go new file mode 100644 index 000000000000..b64b4ec1b204 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand.go @@ -0,0 +1,76 @@ +package managedclusters + +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/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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c ManagedClustersClient) RunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c ManagedClustersClient) RunCommandThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand_autorest.go deleted file mode 100644 index 52b3f6831890..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_runcommand_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 RunCommandOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *RunCommandResult -} - -// RunCommand ... -func (c ManagedClustersClient) RunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (result RunCommandOperationResponse, err error) { - req, err := c.preparerForRunCommand(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RunCommand", nil, "Failure preparing request") - return - } - - result, err = c.senderForRunCommand(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RunCommand", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RunCommandThenPoll performs RunCommand then polls until it's completed -func (c ManagedClustersClient) RunCommandThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) error { - result, err := c.RunCommand(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RunCommand: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RunCommand: %+v", err) - } - - return nil -} - -// preparerForRunCommand prepares the RunCommand request. -func (c ManagedClustersClient) preparerForRunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (*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/runCommand", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRunCommand sends the RunCommand request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRunCommand(ctx context.Context, req *http.Request) (future RunCommandOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start.go new file mode 100644 index 000000000000..ba4549e76155 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c ManagedClustersClient) Start(ctx context.Context, id commonids.KubernetesClusterId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c ManagedClustersClient) StartThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start_autorest.go deleted file mode 100644 index 523cd6864891..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_start_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Start ... -func (c ManagedClustersClient) Start(ctx context.Context, id commonids.KubernetesClusterId) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c ManagedClustersClient) StartThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.Start(ctx, id) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c ManagedClustersClient) preparerForStart(ctx context.Context, id commonids.KubernetesClusterId) (*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/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop.go new file mode 100644 index 000000000000..3bec609e3b46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Stop ... +func (c ManagedClustersClient) Stop(ctx context.Context, id commonids.KubernetesClusterId) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", 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 +} + +// StopThenPoll performs Stop then polls until it's completed +func (c ManagedClustersClient) StopThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop_autorest.go deleted file mode 100644 index ecd7e737a40d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_stop_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Stop ... -func (c ManagedClustersClient) Stop(ctx context.Context, id commonids.KubernetesClusterId) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c ManagedClustersClient) StopThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.Stop(ctx, id) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c ManagedClustersClient) preparerForStop(ctx context.Context, id commonids.KubernetesClusterId) (*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/stop", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, 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/containerservice/2022-09-02-preview/managedclusters/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags.go new file mode 100644 index 000000000000..1ed48544bf91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 UpdateTagsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// UpdateTags ... +func (c ManagedClustersClient) UpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (result UpdateTagsOperationResponse, 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 +} + +// UpdateTagsThenPoll performs UpdateTags then polls until it's completed +func (c ManagedClustersClient) UpdateTagsThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) error { + result, err := c.UpdateTags(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateTags: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateTags: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags_autorest.go deleted file mode 100644 index 6b582645a14c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/method_updatetags_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 UpdateTagsOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *ManagedCluster -} - -// UpdateTags ... -func (c ManagedClustersClient) UpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdateTags(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateTagsThenPoll performs UpdateTags then polls until it's completed -func (c ManagedClustersClient) UpdateTagsThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) error { - result, err := c.UpdateTags(ctx, id, input) - if err != nil { - return fmt.Errorf("performing UpdateTags: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after UpdateTags: %+v", err) - } - - return nil -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c ManagedClustersClient) preparerForUpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (*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)) -} - -// senderForUpdateTags sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForUpdateTags(ctx context.Context, req *http.Request) (future UpdateTagsOperationResponse, 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/containerservice/2022-09-02-preview/managedclustersnapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/client.go index cf2e2f098d7e..939ebd0b9843 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/client.go @@ -1,18 +1,26 @@ package managedclustersnapshots -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 ManagedClusterSnapshotsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedClusterSnapshotsClientWithBaseURI(endpoint string) ManagedClusterSnapshotsClient { - return ManagedClusterSnapshotsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedClusterSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedClusterSnapshotsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedclustersnapshots", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedClusterSnapshotsClient: %+v", err) } + + return &ManagedClusterSnapshotsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/constants.go index b000a6bb1300..ed2cfee4a4a1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/constants.go @@ -1,6 +1,10 @@ package managedclustersnapshots -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 PossibleValuesForLoadBalancerSku() []string { } } +func (s *LoadBalancerSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoadBalancerSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoadBalancerSku(input string) (*LoadBalancerSku, error) { vals := map[string]LoadBalancerSku{ "basic": LoadBalancerSkuBasic, @@ -45,6 +62,19 @@ func PossibleValuesForManagedClusterSKUName() []string { } } +func (s *ManagedClusterSKUName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUName(input string) (*ManagedClusterSKUName, error) { vals := map[string]ManagedClusterSKUName{ "basic": ManagedClusterSKUNameBasic, @@ -72,6 +102,19 @@ func PossibleValuesForManagedClusterSKUTier() []string { } } +func (s *ManagedClusterSKUTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUTier(input string) (*ManagedClusterSKUTier, error) { vals := map[string]ManagedClusterSKUTier{ "free": ManagedClusterSKUTierFree, @@ -100,6 +143,19 @@ func PossibleValuesForNetworkMode() []string { } } +func (s *NetworkMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkMode(input string) (*NetworkMode, error) { vals := map[string]NetworkMode{ "bridge": NetworkModeBridge, @@ -130,6 +186,19 @@ func PossibleValuesForNetworkPlugin() []string { } } +func (s *NetworkPlugin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPlugin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPlugin(input string) (*NetworkPlugin, error) { vals := map[string]NetworkPlugin{ "azure": NetworkPluginAzure, @@ -157,6 +226,19 @@ func PossibleValuesForNetworkPluginMode() []string { } } +func (s *NetworkPluginMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPluginMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPluginMode(input string) (*NetworkPluginMode, error) { vals := map[string]NetworkPluginMode{ "overlay": NetworkPluginModeOverlay, @@ -184,6 +266,19 @@ func PossibleValuesForNetworkPolicy() []string { } } +func (s *NetworkPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPolicy(input string) (*NetworkPolicy, error) { vals := map[string]NetworkPolicy{ "azure": NetworkPolicyAzure, @@ -212,6 +307,19 @@ func PossibleValuesForSnapshotType() []string { } } +func (s *SnapshotType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSnapshotType(input string) (*SnapshotType, error) { vals := map[string]SnapshotType{ "managedcluster": SnapshotTypeManagedCluster, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate.go new file mode 100644 index 000000000000..8ea018ea457a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate.go @@ -0,0 +1,56 @@ +package managedclustersnapshots + +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 *ManagedClusterSnapshot +} + +// CreateOrUpdate ... +func (c ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, id ManagedClusterSnapshotId, input ManagedClusterSnapshot) (result CreateOrUpdateOperationResponse, 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/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate_autorest.go deleted file mode 100644 index d233c363c67f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclustersnapshots - -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 *ManagedClusterSnapshot -} - -// CreateOrUpdate ... -func (c ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, id ManagedClusterSnapshotId, input ManagedClusterSnapshot) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ManagedClusterSnapshotsClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedClusterSnapshotId, input ManagedClusterSnapshot) (*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 ManagedClusterSnapshotsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete.go new file mode 100644 index 000000000000..3b8fc26cc156 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete.go @@ -0,0 +1,47 @@ +package managedclustersnapshots + +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 ManagedClusterSnapshotsClient) Delete(ctx context.Context, id ManagedClusterSnapshotId) (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/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete_autorest.go deleted file mode 100644 index c5c5ab24ba5e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package managedclustersnapshots - -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 ManagedClusterSnapshotsClient) Delete(ctx context.Context, id ManagedClusterSnapshotId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ManagedClusterSnapshotsClient) preparerForDelete(ctx context.Context, id ManagedClusterSnapshotId) (*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 ManagedClusterSnapshotsClient) 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/containerservice/2022-09-02-preview/managedclustersnapshots/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_get.go new file mode 100644 index 000000000000..1fb5543f3c38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_get.go @@ -0,0 +1,51 @@ +package managedclustersnapshots + +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 *ManagedClusterSnapshot +} + +// Get ... +func (c ManagedClusterSnapshotsClient) Get(ctx context.Context, id ManagedClusterSnapshotId) (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/containerservice/2022-09-02-preview/managedclustersnapshots/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_get_autorest.go deleted file mode 100644 index 9fba067e0a72..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclustersnapshots - -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 *ManagedClusterSnapshot -} - -// Get ... -func (c ManagedClusterSnapshotsClient) Get(ctx context.Context, id ManagedClusterSnapshotId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClusterSnapshotsClient) preparerForGet(ctx context.Context, id ManagedClusterSnapshotId) (*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 ManagedClusterSnapshotsClient) 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/containerservice/2022-09-02-preview/managedclustersnapshots/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list.go new file mode 100644 index 000000000000..9f0d4dec6996 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list.go @@ -0,0 +1,92 @@ +package managedclustersnapshots + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ManagedClusterSnapshot +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedClusterSnapshot +} + +// List ... +func (c ManagedClusterSnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/managedClusterSnapshots", 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 *[]ManagedClusterSnapshot `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 ManagedClusterSnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClusterSnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterSnapshotOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ManagedClusterSnapshot, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list_autorest.go deleted file mode 100644 index 19f3b342c53f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclustersnapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ManagedClusterSnapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ManagedClusterSnapshot -} - -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) -} - -// List ... -func (c ManagedClusterSnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ManagedClusterSnapshotsClient) preparerForList(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.ContainerService/managedClusterSnapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ManagedClusterSnapshotsClient) 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 ManagedClusterSnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ManagedClusterSnapshot `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, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ManagedClusterSnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterSnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterSnapshotOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ManagedClusterSnapshot, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup.go new file mode 100644 index 000000000000..4b28f6c8a057 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedclustersnapshots + +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 *[]ManagedClusterSnapshot +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedClusterSnapshot +} + +// ListByResourceGroup ... +func (c ManagedClusterSnapshotsClient) 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.ContainerService/managedClusterSnapshots", 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 *[]ManagedClusterSnapshot `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 ManagedClusterSnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClusterSnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterSnapshotOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedClusterSnapshot, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 4b10b8734d1e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclustersnapshots - -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 *[]ManagedClusterSnapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedClusterSnapshot -} - -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 ManagedClusterSnapshotsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClusterSnapshotsClient) 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.ContainerService/managedClusterSnapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClusterSnapshotsClient) 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 ManagedClusterSnapshotsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ManagedClusterSnapshot `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, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClusterSnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterSnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterSnapshotOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedClusterSnapshot, 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/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags.go new file mode 100644 index 000000000000..050b9d5e3c31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags.go @@ -0,0 +1,55 @@ +package managedclustersnapshots + +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 UpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterSnapshot +} + +// UpdateTags ... +func (c ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, id ManagedClusterSnapshotId, input TagsObject) (result UpdateTagsOperationResponse, 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/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags_autorest.go deleted file mode 100644 index 2f431e58362a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/method_updatetags_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclustersnapshots - -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 UpdateTagsOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterSnapshot -} - -// UpdateTags ... -func (c ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, id ManagedClusterSnapshotId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdateTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "UpdateTags", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c ManagedClusterSnapshotsClient) preparerForUpdateTags(ctx context.Context, id ManagedClusterSnapshotId, input TagsObject) (*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)) -} - -// responderForUpdateTags handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (c ManagedClusterSnapshotsClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, 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/containerservice/2022-09-02-preview/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/client.go index 1de584406fe4..3bf7a6afe1ff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/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/containerservice/2022-09-02-preview/privateendpointconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/constants.go index 76f59a475f34..2fca3d8c93bc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/constants.go @@ -1,6 +1,10 @@ package privateendpointconnections -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. @@ -23,6 +27,19 @@ func PossibleValuesForConnectionStatus() []string { } } +func (s *ConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectionStatus(input string) (*ConnectionStatus, error) { vals := map[string]ConnectionStatus{ "approved": ConnectionStatusApproved, @@ -57,6 +74,19 @@ func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { } } +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { vals := map[string]PrivateEndpointConnectionProvisioningState{ "creating": PrivateEndpointConnectionProvisioningStateCreating, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_delete.go new file mode 100644 index 000000000000..2b9a343bdf02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_delete.go @@ -0,0 +1,70 @@ +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.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/containerservice/2022-09-02-preview/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_delete_autorest.go deleted file mode 100644 index ef4fd3d8e664..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/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/containerservice/2022-09-02-preview/privateendpointconnections/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_get.go new file mode 100644 index 000000000000..6aeba2f77f92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/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/containerservice/2022-09-02-preview/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_get_autorest.go deleted file mode 100644 index 44bbdcb8f0bf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/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/containerservice/2022-09-02-preview/privateendpointconnections/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_list.go new file mode 100644 index 000000000000..d996c0de2d9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_list.go @@ -0,0 +1,53 @@ +package privateendpointconnections + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnectionListResult +} + +// List ... +func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, 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.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/containerservice/2022-09-02-preview/privateendpointconnections/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_list_autorest.go deleted file mode 100644 index e2eaeb5697bc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_list_autorest.go +++ /dev/null @@ -1,70 +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/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 ListOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnectionListResult -} - -// List ... -func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", 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", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c PrivateEndpointConnectionsClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/containerservice/2022-09-02-preview/privateendpointconnections/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_update.go new file mode 100644 index 000000000000..042bf85090eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_update.go @@ -0,0 +1,55 @@ +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// Update ... +func (c PrivateEndpointConnectionsClient) Update(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result UpdateOperationResponse, 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/containerservice/2022-09-02-preview/privateendpointconnections/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_update_autorest.go deleted file mode 100644 index a2c450c04823..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/method_update_autorest.go +++ /dev/null @@ -1,69 +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 UpdateOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// Update ... -func (c PrivateEndpointConnectionsClient) Update(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", 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", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c PrivateEndpointConnectionsClient) preparerForUpdate(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)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) 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/containerservice/2022-09-02-preview/privatelinkresources/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/client.go index 5f532940700f..e6e22caa7468 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/client.go @@ -1,18 +1,26 @@ package privatelinkresources -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 PrivateLinkResourcesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(endpoint string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPrivateLinkResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkResourcesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "privatelinkresources", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) } + + return &PrivateLinkResourcesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list.go new file mode 100644 index 000000000000..6bd58b383e4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list.go @@ -0,0 +1,53 @@ +package privatelinkresources + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResourcesListResult +} + +// List ... +func (c PrivateLinkResourcesClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateLinkResources", 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/containerservice/2022-09-02-preview/privatelinkresources/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list_autorest.go deleted file mode 100644 index 978d829230a5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package privatelinkresources - -import ( - "context" - "fmt" - "net/http" - - "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 ListOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResourcesListResult -} - -// List ... -func (c PrivateLinkResourcesClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c PrivateLinkResourcesClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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/privateLinkResources", id.ID())), - 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 PrivateLinkResourcesClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/client.go index ba3d29ae6f0d..dd21ffc0b6b5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/client.go @@ -1,18 +1,26 @@ package resolveprivatelinkserviceid -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 ResolvePrivateLinkServiceIdClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewResolvePrivateLinkServiceIdClientWithBaseURI(endpoint string) ResolvePrivateLinkServiceIdClient { - return ResolvePrivateLinkServiceIdClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewResolvePrivateLinkServiceIdClientWithBaseURI(sdkApi sdkEnv.Api) (*ResolvePrivateLinkServiceIdClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "resolveprivatelinkserviceid", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ResolvePrivateLinkServiceIdClient: %+v", err) } + + return &ResolvePrivateLinkServiceIdClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post.go new file mode 100644 index 000000000000..9b36ee0f1734 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post.go @@ -0,0 +1,57 @@ +package resolveprivatelinkserviceid + +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 POSTOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResource +} + +// POST ... +func (c ResolvePrivateLinkServiceIdClient) POST(ctx context.Context, id commonids.KubernetesClusterId, input PrivateLinkResource) (result POSTOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resolvePrivateLinkServiceId", 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/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post_autorest.go deleted file mode 100644 index 8f98c5958a5d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/method_post_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package resolveprivatelinkserviceid - -import ( - "context" - "fmt" - "net/http" - - "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 POSTOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResource -} - -// POST ... -func (c ResolvePrivateLinkServiceIdClient) POST(ctx context.Context, id commonids.KubernetesClusterId, input PrivateLinkResource) (result POSTOperationResponse, err error) { - req, err := c.preparerForPOST(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "resolveprivatelinkserviceid.ResolvePrivateLinkServiceIdClient", "POST", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "resolveprivatelinkserviceid.ResolvePrivateLinkServiceIdClient", "POST", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPOST(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "resolveprivatelinkserviceid.ResolvePrivateLinkServiceIdClient", "POST", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPOST prepares the POST request. -func (c ResolvePrivateLinkServiceIdClient) preparerForPOST(ctx context.Context, id commonids.KubernetesClusterId, input PrivateLinkResource) (*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/resolvePrivateLinkServiceId", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPOST handles the response to the POST request. The method always -// closes the http.Response Body. -func (c ResolvePrivateLinkServiceIdClient) responderForPOST(resp *http.Response) (result POSTOperationResponse, 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/containerservice/2022-09-02-preview/snapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/client.go index 62d2a1323835..620b7900eab7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/client.go @@ -1,18 +1,26 @@ package snapshots -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 SnapshotsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSnapshotsClientWithBaseURI(endpoint string) SnapshotsClient { - return SnapshotsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) } + + return &SnapshotsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/constants.go index 69ba232110a1..74b099079a0c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/constants.go @@ -1,6 +1,10 @@ package snapshots -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. @@ -25,6 +29,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "cblmariner": OSSKUCBLMariner, @@ -56,6 +73,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -84,6 +114,19 @@ func PossibleValuesForSnapshotType() []string { } } +func (s *SnapshotType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSnapshotType(input string) (*SnapshotType, error) { vals := map[string]SnapshotType{ "managedcluster": SnapshotTypeManagedCluster, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate.go new file mode 100644 index 000000000000..dc9a67647604 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate.go @@ -0,0 +1,56 @@ +package snapshots + +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 *Snapshot +} + +// CreateOrUpdate ... +func (c SnapshotsClient) CreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOrUpdateOperationResponse, 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/containerservice/2022-09-02-preview/snapshots/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate_autorest.go deleted file mode 100644 index 29d10e44f6e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// CreateOrUpdate ... -func (c SnapshotsClient) CreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SnapshotsClient) preparerForCreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (*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 SnapshotsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/containerservice/2022-09-02-preview/snapshots/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_delete.go new file mode 100644 index 000000000000..575cb8a6929b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_delete.go @@ -0,0 +1,47 @@ +package snapshots + +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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (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/containerservice/2022-09-02-preview/snapshots/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_delete_autorest.go deleted file mode 100644 index 11173f290039..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c SnapshotsClient) preparerForDelete(ctx context.Context, id SnapshotId) (*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 SnapshotsClient) 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/containerservice/2022-09-02-preview/snapshots/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_get.go new file mode 100644 index 000000000000..4f024ded4736 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_get.go @@ -0,0 +1,51 @@ +package snapshots + +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 *Snapshot +} + +// Get ... +func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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/containerservice/2022-09-02-preview/snapshots/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_get_autorest.go deleted file mode 100644 index b328ad1cf52e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SnapshotsClient) preparerForGet(ctx context.Context, id SnapshotId) (*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 SnapshotsClient) 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/containerservice/2022-09-02-preview/snapshots/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list.go new file mode 100644 index 000000000000..bdefce6bb904 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list.go @@ -0,0 +1,92 @@ +package snapshots + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Snapshot +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Snapshot +} + +// List ... +func (c SnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/snapshots", 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 *[]Snapshot `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 SnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SnapshotOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Snapshot, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list_autorest.go deleted file mode 100644 index 6222a23b06d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]Snapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []Snapshot -} - -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) -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c SnapshotsClient) preparerForList(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.ContainerService/snapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c SnapshotsClient) 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 SnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []Snapshot `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, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c SnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SnapshotOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]Snapshot, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup.go new file mode 100644 index 000000000000..824b8dc7cb6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package snapshots + +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 *[]Snapshot +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Snapshot +} + +// ListByResourceGroup ... +func (c SnapshotsClient) 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.ContainerService/snapshots", 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 *[]Snapshot `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 SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SnapshotOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Snapshot, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f034336ecfe8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package snapshots - -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 *[]Snapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Snapshot -} - -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 SnapshotsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c SnapshotsClient) 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.ContainerService/snapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c SnapshotsClient) 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 SnapshotsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Snapshot `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, "snapshots.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SnapshotOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Snapshot, 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/containerservice/2022-09-02-preview/snapshots/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_updatetags.go new file mode 100644 index 000000000000..19bbc0cf0e74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_updatetags.go @@ -0,0 +1,55 @@ +package snapshots + +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 UpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Snapshot +} + +// UpdateTags ... +func (c SnapshotsClient) UpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (result UpdateTagsOperationResponse, 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/containerservice/2022-09-02-preview/snapshots/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_updatetags_autorest.go deleted file mode 100644 index e370c6b54a58..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/method_updatetags_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package snapshots - -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 UpdateTagsOperationResponse struct { - HttpResponse *http.Response - Model *Snapshot -} - -// UpdateTags ... -func (c SnapshotsClient) UpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdateTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c SnapshotsClient) preparerForUpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (*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)) -} - -// responderForUpdateTags handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (c SnapshotsClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/client.go index b90dc2eff20b..3478bfc5e372 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/client.go @@ -1,18 +1,26 @@ package trustedaccess -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 TrustedAccessClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTrustedAccessClientWithBaseURI(endpoint string) TrustedAccessClient { - return TrustedAccessClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTrustedAccessClientWithBaseURI(sdkApi sdkEnv.Api) (*TrustedAccessClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "trustedaccess", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TrustedAccessClient: %+v", err) } + + return &TrustedAccessClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/constants.go index 2390d2813c91..0f6f9d3df1f4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/constants.go @@ -1,6 +1,10 @@ package trustedaccess -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. @@ -23,6 +27,19 @@ func PossibleValuesForTrustedAccessRoleBindingProvisioningState() []string { } } +func (s *TrustedAccessRoleBindingProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTrustedAccessRoleBindingProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTrustedAccessRoleBindingProvisioningState(input string) (*TrustedAccessRoleBindingProvisioningState, error) { vals := map[string]TrustedAccessRoleBindingProvisioningState{ "deleting": TrustedAccessRoleBindingProvisioningStateDeleting, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate.go new file mode 100644 index 000000000000..652e336e8bd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate.go @@ -0,0 +1,55 @@ +package trustedaccess + +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 RoleBindingsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TrustedAccessRoleBinding +} + +// RoleBindingsCreateOrUpdate ... +func (c TrustedAccessClient) RoleBindingsCreateOrUpdate(ctx context.Context, id TrustedAccessRoleBindingId, input TrustedAccessRoleBinding) (result RoleBindingsCreateOrUpdateOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go deleted file mode 100644 index 366863993642..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package trustedaccess - -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 RoleBindingsCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *TrustedAccessRoleBinding -} - -// RoleBindingsCreateOrUpdate ... -func (c TrustedAccessClient) RoleBindingsCreateOrUpdate(ctx context.Context, id TrustedAccessRoleBindingId, input TrustedAccessRoleBinding) (result RoleBindingsCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForRoleBindingsCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRoleBindingsCreateOrUpdate prepares the RoleBindingsCreateOrUpdate request. -func (c TrustedAccessClient) preparerForRoleBindingsCreateOrUpdate(ctx context.Context, id TrustedAccessRoleBindingId, input TrustedAccessRoleBinding) (*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)) -} - -// responderForRoleBindingsCreateOrUpdate handles the response to the RoleBindingsCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsCreateOrUpdate(resp *http.Response) (result RoleBindingsCreateOrUpdateOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete.go new file mode 100644 index 000000000000..6f782d1a92c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete.go @@ -0,0 +1,47 @@ +package trustedaccess + +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 RoleBindingsDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RoleBindingsDelete ... +func (c TrustedAccessClient) RoleBindingsDelete(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsDeleteOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go deleted file mode 100644 index 7e088ee71ce8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package trustedaccess - -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 RoleBindingsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// RoleBindingsDelete ... -func (c TrustedAccessClient) RoleBindingsDelete(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsDeleteOperationResponse, err error) { - req, err := c.preparerForRoleBindingsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRoleBindingsDelete prepares the RoleBindingsDelete request. -func (c TrustedAccessClient) preparerForRoleBindingsDelete(ctx context.Context, id TrustedAccessRoleBindingId) (*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)) -} - -// responderForRoleBindingsDelete handles the response to the RoleBindingsDelete request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsDelete(resp *http.Response) (result RoleBindingsDeleteOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget.go new file mode 100644 index 000000000000..f54366185d52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget.go @@ -0,0 +1,51 @@ +package trustedaccess + +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 RoleBindingsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TrustedAccessRoleBinding +} + +// RoleBindingsGet ... +func (c TrustedAccessClient) RoleBindingsGet(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsGetOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget_autorest.go deleted file mode 100644 index c51acc2a35e4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package trustedaccess - -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 RoleBindingsGetOperationResponse struct { - HttpResponse *http.Response - Model *TrustedAccessRoleBinding -} - -// RoleBindingsGet ... -func (c TrustedAccessClient) RoleBindingsGet(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsGetOperationResponse, err error) { - req, err := c.preparerForRoleBindingsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRoleBindingsGet prepares the RoleBindingsGet request. -func (c TrustedAccessClient) preparerForRoleBindingsGet(ctx context.Context, id TrustedAccessRoleBindingId) (*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)) -} - -// responderForRoleBindingsGet handles the response to the RoleBindingsGet request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsGet(resp *http.Response) (result RoleBindingsGetOperationResponse, 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/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist.go new file mode 100644 index 000000000000..4fc3b544dc01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist.go @@ -0,0 +1,92 @@ +package trustedaccess + +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 RoleBindingsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TrustedAccessRoleBinding +} + +type RoleBindingsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []TrustedAccessRoleBinding +} + +// RoleBindingsList ... +func (c TrustedAccessClient) RoleBindingsList(ctx context.Context, id commonids.KubernetesClusterId) (result RoleBindingsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/trustedAccessRoleBindings", 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 *[]TrustedAccessRoleBinding `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// RoleBindingsListComplete retrieves all the results into a single object +func (c TrustedAccessClient) RoleBindingsListComplete(ctx context.Context, id commonids.KubernetesClusterId) (RoleBindingsListCompleteResult, error) { + return c.RoleBindingsListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleBindingOperationPredicate{}) +} + +// RoleBindingsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TrustedAccessClient) RoleBindingsListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate TrustedAccessRoleBindingOperationPredicate) (result RoleBindingsListCompleteResult, err error) { + items := make([]TrustedAccessRoleBinding, 0) + + resp, err := c.RoleBindingsList(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 = RoleBindingsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist_autorest.go deleted file mode 100644 index 0358b505cbc7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_rolebindingslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package trustedaccess - -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 RoleBindingsListOperationResponse struct { - HttpResponse *http.Response - Model *[]TrustedAccessRoleBinding - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (RoleBindingsListOperationResponse, error) -} - -type RoleBindingsListCompleteResult struct { - Items []TrustedAccessRoleBinding -} - -func (r RoleBindingsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r RoleBindingsListOperationResponse) LoadMore(ctx context.Context) (resp RoleBindingsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// RoleBindingsList ... -func (c TrustedAccessClient) RoleBindingsList(ctx context.Context, id commonids.KubernetesClusterId) (resp RoleBindingsListOperationResponse, err error) { - req, err := c.preparerForRoleBindingsList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForRoleBindingsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForRoleBindingsList prepares the RoleBindingsList request. -func (c TrustedAccessClient) preparerForRoleBindingsList(ctx context.Context, id commonids.KubernetesClusterId) (*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/trustedAccessRoleBindings", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForRoleBindingsListWithNextLink prepares the RoleBindingsList request with the given nextLink token. -func (c TrustedAccessClient) preparerForRoleBindingsListWithNextLink(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)) -} - -// responderForRoleBindingsList handles the response to the RoleBindingsList request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsList(resp *http.Response) (result RoleBindingsListOperationResponse, err error) { - type page struct { - Values []TrustedAccessRoleBinding `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 RoleBindingsListOperationResponse, err error) { - req, err := c.preparerForRoleBindingsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// RoleBindingsListComplete retrieves all of the results into a single object -func (c TrustedAccessClient) RoleBindingsListComplete(ctx context.Context, id commonids.KubernetesClusterId) (RoleBindingsListCompleteResult, error) { - return c.RoleBindingsListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleBindingOperationPredicate{}) -} - -// RoleBindingsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TrustedAccessClient) RoleBindingsListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate TrustedAccessRoleBindingOperationPredicate) (resp RoleBindingsListCompleteResult, err error) { - items := make([]TrustedAccessRoleBinding, 0) - - page, err := c.RoleBindingsList(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 := RoleBindingsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist.go new file mode 100644 index 000000000000..124133a7f5e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist.go @@ -0,0 +1,91 @@ +package trustedaccess + +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 RolesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TrustedAccessRole +} + +type RolesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []TrustedAccessRole +} + +// RolesList ... +func (c TrustedAccessClient) RolesList(ctx context.Context, id LocationId) (result RolesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/trustedAccessRoles", 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 *[]TrustedAccessRole `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// RolesListComplete retrieves all the results into a single object +func (c TrustedAccessClient) RolesListComplete(ctx context.Context, id LocationId) (RolesListCompleteResult, error) { + return c.RolesListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleOperationPredicate{}) +} + +// RolesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TrustedAccessClient) RolesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate TrustedAccessRoleOperationPredicate) (result RolesListCompleteResult, err error) { + items := make([]TrustedAccessRole, 0) + + resp, err := c.RolesList(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 = RolesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist_autorest.go deleted file mode 100644 index 5e6dbfb4de99..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/method_roleslist_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package trustedaccess - -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 RolesListOperationResponse struct { - HttpResponse *http.Response - Model *[]TrustedAccessRole - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (RolesListOperationResponse, error) -} - -type RolesListCompleteResult struct { - Items []TrustedAccessRole -} - -func (r RolesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r RolesListOperationResponse) LoadMore(ctx context.Context) (resp RolesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// RolesList ... -func (c TrustedAccessClient) RolesList(ctx context.Context, id LocationId) (resp RolesListOperationResponse, err error) { - req, err := c.preparerForRolesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForRolesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForRolesList prepares the RolesList request. -func (c TrustedAccessClient) preparerForRolesList(ctx context.Context, id LocationId) (*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/trustedAccessRoles", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForRolesListWithNextLink prepares the RolesList request with the given nextLink token. -func (c TrustedAccessClient) preparerForRolesListWithNextLink(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)) -} - -// responderForRolesList handles the response to the RolesList request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRolesList(resp *http.Response) (result RolesListOperationResponse, err error) { - type page struct { - Values []TrustedAccessRole `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 RolesListOperationResponse, err error) { - req, err := c.preparerForRolesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRolesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// RolesListComplete retrieves all of the results into a single object -func (c TrustedAccessClient) RolesListComplete(ctx context.Context, id LocationId) (RolesListCompleteResult, error) { - return c.RolesListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleOperationPredicate{}) -} - -// RolesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TrustedAccessClient) RolesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate TrustedAccessRoleOperationPredicate) (resp RolesListCompleteResult, err error) { - items := make([]TrustedAccessRole, 0) - - page, err := c.RolesList(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 := RolesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/client.go index f4128f5c794c..2edad36c0059 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/client.go @@ -1,18 +1,26 @@ package agentpools -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 AgentPoolsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAgentPoolsClientWithBaseURI(endpoint string) AgentPoolsClient { - return AgentPoolsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAgentPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*AgentPoolsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "agentpools", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AgentPoolsClient: %+v", err) } + + return &AgentPoolsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/constants.go index 2cf9748edd4f..faa42332c0fb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/constants.go @@ -1,6 +1,10 @@ package agentpools -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 PossibleValuesForAgentPoolMode() []string { } } +func (s *AgentPoolMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolMode(input string) (*AgentPoolMode, error) { vals := map[string]AgentPoolMode{ "system": AgentPoolModeSystem, @@ -47,6 +64,19 @@ func PossibleValuesForAgentPoolType() []string { } } +func (s *AgentPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolType(input string) (*AgentPoolType, error) { vals := map[string]AgentPoolType{ "availabilityset": AgentPoolTypeAvailabilitySet, @@ -75,6 +105,19 @@ func PossibleValuesForCode() []string { } } +func (s *Code) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCode(input string) (*Code, error) { vals := map[string]Code{ "running": CodeRunning, @@ -109,6 +152,19 @@ func PossibleValuesForGPUInstanceProfile() []string { } } +func (s *GPUInstanceProfile) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGPUInstanceProfile(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGPUInstanceProfile(input string) (*GPUInstanceProfile, error) { vals := map[string]GPUInstanceProfile{ "mig4g": GPUInstanceProfileMIGFourg, @@ -140,6 +196,19 @@ func PossibleValuesForKubeletDiskType() []string { } } +func (s *KubeletDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubeletDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubeletDiskType(input string) (*KubeletDiskType, error) { vals := map[string]KubeletDiskType{ "os": KubeletDiskTypeOS, @@ -168,6 +237,19 @@ func PossibleValuesForOSDiskType() []string { } } +func (s *OSDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSDiskType(input string) (*OSDiskType, error) { vals := map[string]OSDiskType{ "ephemeral": OSDiskTypeEphemeral, @@ -202,6 +284,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "cblmariner": OSSKUCBLMariner, @@ -233,6 +328,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -261,6 +369,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTCP, @@ -289,6 +410,19 @@ func PossibleValuesForScaleDownMode() []string { } } +func (s *ScaleDownMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleDownMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleDownMode(input string) (*ScaleDownMode, error) { vals := map[string]ScaleDownMode{ "deallocate": ScaleDownModeDeallocate, @@ -317,6 +451,19 @@ func PossibleValuesForScaleSetEvictionPolicy() []string { } } +func (s *ScaleSetEvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetEvictionPolicy(input string) (*ScaleSetEvictionPolicy, error) { vals := map[string]ScaleSetEvictionPolicy{ "deallocate": ScaleSetEvictionPolicyDeallocate, @@ -345,6 +492,19 @@ func PossibleValuesForScaleSetPriority() []string { } } +func (s *ScaleSetPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetPriority(input string) (*ScaleSetPriority, error) { vals := map[string]ScaleSetPriority{ "regular": ScaleSetPriorityRegular, @@ -375,6 +535,19 @@ func PossibleValuesForWorkloadRuntime() []string { } } +func (s *WorkloadRuntime) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadRuntime(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWorkloadRuntime(input string) (*WorkloadRuntime, error) { vals := map[string]WorkloadRuntime{ "katamshvvmisolation": WorkloadRuntimeKataMshvVMIsolation, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation.go new file mode 100644 index 000000000000..bb6d06d7487d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation.go @@ -0,0 +1,70 @@ +package agentpools + +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 AbortLatestOperationOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AbortLatestOperation ... +func (c AgentPoolsClient) AbortLatestOperation(ctx context.Context, id AgentPoolId) (result AbortLatestOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/abort", 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 +} + +// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed +func (c AgentPoolsClient) AbortLatestOperationThenPoll(ctx context.Context, id AgentPoolId) error { + result, err := c.AbortLatestOperation(ctx, id) + if err != nil { + return fmt.Errorf("performing AbortLatestOperation: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AbortLatestOperation: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation_autorest.go deleted file mode 100644 index 62c453808c5d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_abortlatestoperation_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package agentpools - -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 AbortLatestOperationOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AbortLatestOperation ... -func (c AgentPoolsClient) AbortLatestOperation(ctx context.Context, id AgentPoolId) (result AbortLatestOperationOperationResponse, err error) { - req, err := c.preparerForAbortLatestOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", nil, "Failure preparing request") - return - } - - result, err = c.senderForAbortLatestOperation(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed -func (c AgentPoolsClient) AbortLatestOperationThenPoll(ctx context.Context, id AgentPoolId) error { - result, err := c.AbortLatestOperation(ctx, id) - if err != nil { - return fmt.Errorf("performing AbortLatestOperation: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AbortLatestOperation: %+v", err) - } - - return nil -} - -// preparerForAbortLatestOperation prepares the AbortLatestOperation request. -func (c AgentPoolsClient) preparerForAbortLatestOperation(ctx context.Context, id AgentPoolId) (*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/abort", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAbortLatestOperation sends the AbortLatestOperation request. The method will close the -// http.Response Body if it receives an error. -func (c AgentPoolsClient) senderForAbortLatestOperation(ctx context.Context, req *http.Request) (future AbortLatestOperationOperationResponse, 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/containerservice/2023-03-02-preview/agentpools/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_createorupdate.go new file mode 100644 index 000000000000..8df06205d3a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_createorupdate.go @@ -0,0 +1,75 @@ +package agentpools + +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 + Model *AgentPool +} + +// CreateOrUpdate ... +func (c AgentPoolsClient) CreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AgentPoolsClient) CreateOrUpdateThenPoll(ctx context.Context, id AgentPoolId, input AgentPool) 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/containerservice/2023-03-02-preview/agentpools/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_createorupdate_autorest.go deleted file mode 100644 index 376fc7fd167f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_createorupdate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package agentpools - -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 - Model *AgentPool -} - -// CreateOrUpdate ... -func (c AgentPoolsClient) CreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c AgentPoolsClient) CreateOrUpdateThenPoll(ctx context.Context, id AgentPoolId, input AgentPool) 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 AgentPoolsClient) preparerForCreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (*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 AgentPoolsClient) 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/containerservice/2023-03-02-preview/agentpools/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_delete.go new file mode 100644 index 000000000000..d628abea0ea4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_delete.go @@ -0,0 +1,98 @@ +package agentpools + +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 +} + +type DeleteOperationOptions struct { + IgnorePodDisruptionBudget *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IgnorePodDisruptionBudget != nil { + out.Append("ignore-pod-disruption-budget", fmt.Sprintf("%v", *o.IgnorePodDisruptionBudget)) + } + return &out +} + +// Delete ... +func (c AgentPoolsClient) Delete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AgentPoolsClient) DeleteThenPoll(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-03-02-preview/agentpools/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_delete_autorest.go deleted file mode 100644 index 4acc91111ca3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package agentpools - -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 -} - -type DeleteOperationOptions struct { - IgnorePodDisruptionBudget *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IgnorePodDisruptionBudget != nil { - out["ignore-pod-disruption-budget"] = *o.IgnorePodDisruptionBudget - } - - return out -} - -// Delete ... -func (c AgentPoolsClient) Delete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c AgentPoolsClient) DeleteThenPoll(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 AgentPoolsClient) preparerForDelete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 AgentPoolsClient) 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/containerservice/2023-03-02-preview/agentpools/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_get.go new file mode 100644 index 000000000000..ad9eccae1761 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_get.go @@ -0,0 +1,51 @@ +package agentpools + +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 *AgentPool +} + +// Get ... +func (c AgentPoolsClient) Get(ctx context.Context, id AgentPoolId) (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/containerservice/2023-03-02-preview/agentpools/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_get_autorest.go deleted file mode 100644 index 989893ea89d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package agentpools - -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 *AgentPool -} - -// Get ... -func (c AgentPoolsClient) Get(ctx context.Context, id AgentPoolId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AgentPoolsClient) preparerForGet(ctx context.Context, id AgentPoolId) (*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 AgentPoolsClient) 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/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions.go new file mode 100644 index 000000000000..2b16f4ecd6aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions.go @@ -0,0 +1,53 @@ +package agentpools + +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 GetAvailableAgentPoolVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPoolAvailableVersions +} + +// GetAvailableAgentPoolVersions ... +func (c AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (result GetAvailableAgentPoolVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/availableAgentPoolVersions", 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/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go deleted file mode 100644 index 73e49c546708..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package agentpools - -import ( - "context" - "fmt" - "net/http" - - "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 GetAvailableAgentPoolVersionsOperationResponse struct { - HttpResponse *http.Response - Model *AgentPoolAvailableVersions -} - -// GetAvailableAgentPoolVersions ... -func (c AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (result GetAvailableAgentPoolVersionsOperationResponse, err error) { - req, err := c.preparerForGetAvailableAgentPoolVersions(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAvailableAgentPoolVersions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAvailableAgentPoolVersions prepares the GetAvailableAgentPoolVersions request. -func (c AgentPoolsClient) preparerForGetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (*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/availableAgentPoolVersions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAvailableAgentPoolVersions handles the response to the GetAvailableAgentPoolVersions request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForGetAvailableAgentPoolVersions(resp *http.Response) (result GetAvailableAgentPoolVersionsOperationResponse, 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/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile.go new file mode 100644 index 000000000000..518140ec5e80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile.go @@ -0,0 +1,52 @@ +package agentpools + +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 GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPoolUpgradeProfile +} + +// GetUpgradeProfile ... +func (c AgentPoolsClient) GetUpgradeProfile(ctx context.Context, id AgentPoolId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/upgradeProfiles/default", 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/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile_autorest.go deleted file mode 100644 index 0a94e7b1cd75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_getupgradeprofile_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package agentpools - -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 GetUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *AgentPoolUpgradeProfile -} - -// GetUpgradeProfile ... -func (c AgentPoolsClient) GetUpgradeProfile(ctx context.Context, id AgentPoolId) (result GetUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetUpgradeProfile prepares the GetUpgradeProfile request. -func (c AgentPoolsClient) preparerForGetUpgradeProfile(ctx context.Context, id AgentPoolId) (*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/upgradeProfiles/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetUpgradeProfile handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForGetUpgradeProfile(resp *http.Response) (result GetUpgradeProfileOperationResponse, 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/containerservice/2023-03-02-preview/agentpools/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list.go new file mode 100644 index 000000000000..d4f58e969de4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list.go @@ -0,0 +1,92 @@ +package agentpools + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AgentPool +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AgentPool +} + +// List ... +func (c AgentPoolsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/agentPools", 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 *[]AgentPool `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 AgentPoolsClient) ListComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AgentPoolsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate AgentPoolOperationPredicate) (result ListCompleteResult, err error) { + items := make([]AgentPool, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list_autorest.go deleted file mode 100644 index 85002f4ba417..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package agentpools - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]AgentPool - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []AgentPool -} - -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) -} - -// List ... -func (c AgentPoolsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c AgentPoolsClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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/agentPools", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c AgentPoolsClient) 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 AgentPoolsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []AgentPool `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, "agentpools.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c AgentPoolsClient) ListComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AgentPoolsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate AgentPoolOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]AgentPool, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion.go new file mode 100644 index 000000000000..fa6b0240a55f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion.go @@ -0,0 +1,71 @@ +package agentpools + +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 UpgradeNodeImageVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AgentPool +} + +// UpgradeNodeImageVersion ... +func (c AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (result UpgradeNodeImageVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeNodeImageVersion", 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 +} + +// UpgradeNodeImageVersionThenPoll performs UpgradeNodeImageVersion then polls until it's completed +func (c AgentPoolsClient) UpgradeNodeImageVersionThenPoll(ctx context.Context, id AgentPoolId) error { + result, err := c.UpgradeNodeImageVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing UpgradeNodeImageVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpgradeNodeImageVersion: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion_autorest.go deleted file mode 100644 index 8f804652e0fa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/agentpools/method_upgradenodeimageversion_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package agentpools - -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 UpgradeNodeImageVersionOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *AgentPool -} - -// UpgradeNodeImageVersion ... -func (c AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (result UpgradeNodeImageVersionOperationResponse, err error) { - req, err := c.preparerForUpgradeNodeImageVersion(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "UpgradeNodeImageVersion", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpgradeNodeImageVersion(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "UpgradeNodeImageVersion", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpgradeNodeImageVersionThenPoll performs UpgradeNodeImageVersion then polls until it's completed -func (c AgentPoolsClient) UpgradeNodeImageVersionThenPoll(ctx context.Context, id AgentPoolId) error { - result, err := c.UpgradeNodeImageVersion(ctx, id) - if err != nil { - return fmt.Errorf("performing UpgradeNodeImageVersion: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after UpgradeNodeImageVersion: %+v", err) - } - - return nil -} - -// preparerForUpgradeNodeImageVersion prepares the UpgradeNodeImageVersion request. -func (c AgentPoolsClient) preparerForUpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (*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/upgradeNodeImageVersion", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpgradeNodeImageVersion sends the UpgradeNodeImageVersion request. The method will close the -// http.Response Body if it receives an error. -func (c AgentPoolsClient) senderForUpgradeNodeImageVersion(ctx context.Context, req *http.Request) (future UpgradeNodeImageVersionOperationResponse, 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/containerservice/2023-03-02-preview/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/client.go index 55fea16e7e67..1914d29299a2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/client.go @@ -4,7 +4,8 @@ package v2023_03_02_preview // 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/containerservice/2023-03-02-preview/agentpools" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters" @@ -14,6 +15,8 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -28,44 +31,70 @@ type Client struct { TrustedAccess *trustedaccess.TrustedAccessClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - agentPoolsClient := agentpools.NewAgentPoolsClientWithBaseURI(endpoint) - configureAuthFunc(&agentPoolsClient.Client) - - maintenanceConfigurationsClient := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(endpoint) - configureAuthFunc(&maintenanceConfigurationsClient.Client) +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + agentPoolsClient, err := agentpools.NewAgentPoolsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AgentPools client: %+v", err) + } + configureFunc(agentPoolsClient.Client) - managedClusterSnapshotsClient := managedclustersnapshots.NewManagedClusterSnapshotsClientWithBaseURI(endpoint) - configureAuthFunc(&managedClusterSnapshotsClient.Client) + maintenanceConfigurationsClient, err := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building MaintenanceConfigurations client: %+v", err) + } + configureFunc(maintenanceConfigurationsClient.Client) - managedClustersClient := managedclusters.NewManagedClustersClientWithBaseURI(endpoint) - configureAuthFunc(&managedClustersClient.Client) + managedClusterSnapshotsClient, err := managedclustersnapshots.NewManagedClusterSnapshotsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ManagedClusterSnapshots client: %+v", err) + } + configureFunc(managedClusterSnapshotsClient.Client) - privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(endpoint) - configureAuthFunc(&privateEndpointConnectionsClient.Client) + managedClustersClient, err := managedclusters.NewManagedClustersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ManagedClusters client: %+v", err) + } + configureFunc(managedClustersClient.Client) - privateLinkResourcesClient := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(endpoint) - configureAuthFunc(&privateLinkResourcesClient.Client) + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) - resolvePrivateLinkServiceIdClient := resolveprivatelinkserviceid.NewResolvePrivateLinkServiceIdClientWithBaseURI(endpoint) - configureAuthFunc(&resolvePrivateLinkServiceIdClient.Client) + privateLinkResourcesClient, err := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkResources client: %+v", err) + } + configureFunc(privateLinkResourcesClient.Client) - snapshotsClient := snapshots.NewSnapshotsClientWithBaseURI(endpoint) - configureAuthFunc(&snapshotsClient.Client) + resolvePrivateLinkServiceIdClient, err := resolveprivatelinkserviceid.NewResolvePrivateLinkServiceIdClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ResolvePrivateLinkServiceId client: %+v", err) + } + configureFunc(resolvePrivateLinkServiceIdClient.Client) - trustedAccessClient := trustedaccess.NewTrustedAccessClientWithBaseURI(endpoint) - configureAuthFunc(&trustedAccessClient.Client) + snapshotsClient, err := snapshots.NewSnapshotsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Snapshots client: %+v", err) + } + configureFunc(snapshotsClient.Client) - return Client{ - AgentPools: &agentPoolsClient, - MaintenanceConfigurations: &maintenanceConfigurationsClient, - ManagedClusterSnapshots: &managedClusterSnapshotsClient, - ManagedClusters: &managedClustersClient, - PrivateEndpointConnections: &privateEndpointConnectionsClient, - PrivateLinkResources: &privateLinkResourcesClient, - ResolvePrivateLinkServiceId: &resolvePrivateLinkServiceIdClient, - Snapshots: &snapshotsClient, - TrustedAccess: &trustedAccessClient, + trustedAccessClient, err := trustedaccess.NewTrustedAccessClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building TrustedAccess client: %+v", err) } + configureFunc(trustedAccessClient.Client) + + return &Client{ + AgentPools: agentPoolsClient, + MaintenanceConfigurations: maintenanceConfigurationsClient, + ManagedClusterSnapshots: managedClusterSnapshotsClient, + ManagedClusters: managedClustersClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + PrivateLinkResources: privateLinkResourcesClient, + ResolvePrivateLinkServiceId: resolvePrivateLinkServiceIdClient, + Snapshots: snapshotsClient, + TrustedAccess: trustedAccessClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/client.go index c955dc01ae80..4d799de617cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/client.go @@ -1,18 +1,26 @@ package maintenanceconfigurations -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 MaintenanceConfigurationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewMaintenanceConfigurationsClientWithBaseURI(endpoint string) MaintenanceConfigurationsClient { - return MaintenanceConfigurationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewMaintenanceConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*MaintenanceConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "maintenanceconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MaintenanceConfigurationsClient: %+v", err) } + + return &MaintenanceConfigurationsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/constants.go index 7bac817aae7d..2fdd49e9763c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/constants.go @@ -1,6 +1,10 @@ package maintenanceconfigurations -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. @@ -25,6 +29,19 @@ func PossibleValuesForType() []string { } } +func (s *Type) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseType(input string) (*Type, error) { vals := map[string]Type{ "first": TypeFirst, @@ -66,6 +83,19 @@ func PossibleValuesForWeekDay() []string { } } +func (s *WeekDay) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWeekDay(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWeekDay(input string) (*WeekDay, error) { vals := map[string]WeekDay{ "friday": WeekDayFriday, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate.go new file mode 100644 index 000000000000..884829064800 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate.go @@ -0,0 +1,55 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// CreateOrUpdate ... +func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (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/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go deleted file mode 100644 index 57eb1a03ef4b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// CreateOrUpdate ... -func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c MaintenanceConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*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 MaintenanceConfigurationsClient) 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/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete.go new file mode 100644 index 000000000000..5993be4c15a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete.go @@ -0,0 +1,47 @@ +package maintenanceconfigurations + +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 MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (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/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete_autorest.go deleted file mode 100644 index 27bc6b8c8559..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package maintenanceconfigurations - -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 MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c MaintenanceConfigurationsClient) preparerForDelete(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get.go new file mode 100644 index 000000000000..9a6e4324c68e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get.go @@ -0,0 +1,51 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// Get ... +func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (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/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get_autorest.go deleted file mode 100644 index 57a6eb55e01d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// Get ... -func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c MaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go new file mode 100644 index 000000000000..dae38e858212 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go @@ -0,0 +1,92 @@ +package maintenanceconfigurations + +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 ListByManagedClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]MaintenanceConfiguration +} + +type ListByManagedClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []MaintenanceConfiguration +} + +// ListByManagedCluster ... +func (c MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (result ListByManagedClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/maintenanceConfigurations", 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 *[]MaintenanceConfiguration `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByManagedClusterComplete retrieves all the results into a single object +func (c MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListByManagedClusterCompleteResult, error) { + return c.ListByManagedClusterCompleteMatchingPredicate(ctx, id, MaintenanceConfigurationOperationPredicate{}) +} + +// ListByManagedClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MaintenanceConfigurationsClient) ListByManagedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MaintenanceConfigurationOperationPredicate) (result ListByManagedClusterCompleteResult, err error) { + items := make([]MaintenanceConfiguration, 0) + + resp, err := c.ListByManagedCluster(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 = ListByManagedClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go deleted file mode 100644 index 7463165baacd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package maintenanceconfigurations - -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 ListByManagedClusterOperationResponse struct { - HttpResponse *http.Response - Model *[]MaintenanceConfiguration - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByManagedClusterOperationResponse, error) -} - -type ListByManagedClusterCompleteResult struct { - Items []MaintenanceConfiguration -} - -func (r ListByManagedClusterOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByManagedClusterOperationResponse) LoadMore(ctx context.Context) (resp ListByManagedClusterOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByManagedCluster ... -func (c MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (resp ListByManagedClusterOperationResponse, err error) { - req, err := c.preparerForListByManagedCluster(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByManagedCluster(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByManagedCluster prepares the ListByManagedCluster request. -func (c MaintenanceConfigurationsClient) preparerForListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (*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/maintenanceConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByManagedClusterWithNextLink prepares the ListByManagedCluster request with the given nextLink token. -func (c MaintenanceConfigurationsClient) preparerForListByManagedClusterWithNextLink(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)) -} - -// responderForListByManagedCluster handles the response to the ListByManagedCluster request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForListByManagedCluster(resp *http.Response) (result ListByManagedClusterOperationResponse, err error) { - type page struct { - Values []MaintenanceConfiguration `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 ListByManagedClusterOperationResponse, err error) { - req, err := c.preparerForListByManagedClusterWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByManagedCluster(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByManagedClusterComplete retrieves all of the results into a single object -func (c MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListByManagedClusterCompleteResult, error) { - return c.ListByManagedClusterCompleteMatchingPredicate(ctx, id, MaintenanceConfigurationOperationPredicate{}) -} - -// ListByManagedClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MaintenanceConfigurationsClient) ListByManagedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MaintenanceConfigurationOperationPredicate) (resp ListByManagedClusterCompleteResult, err error) { - items := make([]MaintenanceConfiguration, 0) - - page, err := c.ListByManagedCluster(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 := ListByManagedClusterCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/client.go index df94ecc4199e..5081c63c8e61 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/client.go @@ -1,18 +1,26 @@ package managedclusters -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 ManagedClustersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedClustersClientWithBaseURI(endpoint string) ManagedClustersClient { - return ManagedClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedClustersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedClustersClient: %+v", err) } + + return &ManagedClustersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/constants.go index 8b6e500d4f59..2128d6b108bf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/constants.go @@ -1,6 +1,10 @@ package managedclusters -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 PossibleValuesForAgentPoolMode() []string { } } +func (s *AgentPoolMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolMode(input string) (*AgentPoolMode, error) { vals := map[string]AgentPoolMode{ "system": AgentPoolModeSystem, @@ -47,6 +64,19 @@ func PossibleValuesForAgentPoolType() []string { } } +func (s *AgentPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolType(input string) (*AgentPoolType, error) { vals := map[string]AgentPoolType{ "availabilityset": AgentPoolTypeAvailabilitySet, @@ -75,6 +105,19 @@ func PossibleValuesForBackendPoolType() []string { } } +func (s *BackendPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBackendPoolType(input string) (*BackendPoolType, error) { vals := map[string]BackendPoolType{ "nodeip": BackendPoolTypeNodeIP, @@ -103,6 +146,19 @@ func PossibleValuesForCode() []string { } } +func (s *Code) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCode(input string) (*Code, error) { vals := map[string]Code{ "running": CodeRunning, @@ -129,6 +185,19 @@ func PossibleValuesForControlPlaneUpgradeOverride() []string { } } +func (s *ControlPlaneUpgradeOverride) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseControlPlaneUpgradeOverride(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseControlPlaneUpgradeOverride(input string) (*ControlPlaneUpgradeOverride, error) { vals := map[string]ControlPlaneUpgradeOverride{ "ignorekubernetesdeprecations": ControlPlaneUpgradeOverrideIgnoreKubernetesDeprecations, @@ -156,6 +225,19 @@ func PossibleValuesForControlledValues() []string { } } +func (s *ControlledValues) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseControlledValues(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseControlledValues(input string) (*ControlledValues, error) { vals := map[string]ControlledValues{ "requestsandlimits": ControlledValuesRequestsAndLimits, @@ -188,6 +270,19 @@ func PossibleValuesForExpander() []string { } } +func (s *Expander) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpander(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseExpander(input string) (*Expander, error) { vals := map[string]Expander{ "least-waste": ExpanderLeastNegativewaste, @@ -218,6 +313,19 @@ func PossibleValuesForFormat() []string { } } +func (s *Format) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFormat(input string) (*Format, error) { vals := map[string]Format{ "azure": FormatAzure, @@ -252,6 +360,19 @@ func PossibleValuesForGPUInstanceProfile() []string { } } +func (s *GPUInstanceProfile) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGPUInstanceProfile(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGPUInstanceProfile(input string) (*GPUInstanceProfile, error) { vals := map[string]GPUInstanceProfile{ "mig4g": GPUInstanceProfileMIGFourg, @@ -283,6 +404,19 @@ func PossibleValuesForIPFamily() []string { } } +func (s *IPFamily) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPFamily(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIPFamily(input string) (*IPFamily, error) { vals := map[string]IPFamily{ "ipv4": IPFamilyIPvFour, @@ -311,6 +445,19 @@ func PossibleValuesForIPvsScheduler() []string { } } +func (s *IPvsScheduler) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPvsScheduler(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIPvsScheduler(input string) (*IPvsScheduler, error) { vals := map[string]IPvsScheduler{ "leastconnection": IPvsSchedulerLeastConnection, @@ -339,6 +486,19 @@ func PossibleValuesForIstioIngressGatewayMode() []string { } } +func (s *IstioIngressGatewayMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIstioIngressGatewayMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIstioIngressGatewayMode(input string) (*IstioIngressGatewayMode, error) { vals := map[string]IstioIngressGatewayMode{ "external": IstioIngressGatewayModeExternal, @@ -367,6 +527,19 @@ func PossibleValuesForKeyVaultNetworkAccessTypes() []string { } } +func (s *KeyVaultNetworkAccessTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyVaultNetworkAccessTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyVaultNetworkAccessTypes(input string) (*KeyVaultNetworkAccessTypes, error) { vals := map[string]KeyVaultNetworkAccessTypes{ "private": KeyVaultNetworkAccessTypesPrivate, @@ -395,6 +568,19 @@ func PossibleValuesForKubeletDiskType() []string { } } +func (s *KubeletDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubeletDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubeletDiskType(input string) (*KubeletDiskType, error) { vals := map[string]KubeletDiskType{ "os": KubeletDiskTypeOS, @@ -423,6 +609,19 @@ func PossibleValuesForKubernetesSupportPlan() []string { } } +func (s *KubernetesSupportPlan) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubernetesSupportPlan(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubernetesSupportPlan(input string) (*KubernetesSupportPlan, error) { vals := map[string]KubernetesSupportPlan{ "akslongtermsupport": KubernetesSupportPlanAKSLongTermSupport, @@ -453,6 +652,19 @@ func PossibleValuesForLevel() []string { } } +func (s *Level) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLevel(input string) (*Level, error) { vals := map[string]Level{ "enforcement": LevelEnforcement, @@ -482,6 +694,19 @@ func PossibleValuesForLicenseType() []string { } } +func (s *LicenseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLicenseType(input string) (*LicenseType, error) { vals := map[string]LicenseType{ "none": LicenseTypeNone, @@ -510,6 +735,19 @@ func PossibleValuesForLoadBalancerSku() []string { } } +func (s *LoadBalancerSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoadBalancerSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoadBalancerSku(input string) (*LoadBalancerSku, error) { vals := map[string]LoadBalancerSku{ "basic": LoadBalancerSkuBasic, @@ -546,6 +784,19 @@ func PossibleValuesForManagedClusterPodIdentityProvisioningState() []string { } } +func (s *ManagedClusterPodIdentityProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterPodIdentityProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterPodIdentityProvisioningState(input string) (*ManagedClusterPodIdentityProvisioningState, error) { vals := map[string]ManagedClusterPodIdentityProvisioningState{ "assigned": ManagedClusterPodIdentityProvisioningStateAssigned, @@ -576,6 +827,19 @@ func PossibleValuesForManagedClusterSKUName() []string { } } +func (s *ManagedClusterSKUName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUName(input string) (*ManagedClusterSKUName, error) { vals := map[string]ManagedClusterSKUName{ "base": ManagedClusterSKUNameBase, @@ -605,6 +869,19 @@ func PossibleValuesForManagedClusterSKUTier() []string { } } +func (s *ManagedClusterSKUTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUTier(input string) (*ManagedClusterSKUTier, error) { vals := map[string]ManagedClusterSKUTier{ "free": ManagedClusterSKUTierFree, @@ -634,6 +911,19 @@ func PossibleValuesForMode() []string { } } +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMode(input string) (*Mode, error) { vals := map[string]Mode{ "iptables": ModeIPTABLES, @@ -662,6 +952,19 @@ func PossibleValuesForNetworkDataplane() []string { } } +func (s *NetworkDataplane) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkDataplane(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkDataplane(input string) (*NetworkDataplane, error) { vals := map[string]NetworkDataplane{ "azure": NetworkDataplaneAzure, @@ -690,6 +993,19 @@ func PossibleValuesForNetworkMode() []string { } } +func (s *NetworkMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkMode(input string) (*NetworkMode, error) { vals := map[string]NetworkMode{ "bridge": NetworkModeBridge, @@ -720,6 +1036,19 @@ func PossibleValuesForNetworkPlugin() []string { } } +func (s *NetworkPlugin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPlugin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPlugin(input string) (*NetworkPlugin, error) { vals := map[string]NetworkPlugin{ "azure": NetworkPluginAzure, @@ -747,6 +1076,19 @@ func PossibleValuesForNetworkPluginMode() []string { } } +func (s *NetworkPluginMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPluginMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPluginMode(input string) (*NetworkPluginMode, error) { vals := map[string]NetworkPluginMode{ "overlay": NetworkPluginModeOverlay, @@ -776,6 +1118,19 @@ func PossibleValuesForNetworkPolicy() []string { } } +func (s *NetworkPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPolicy(input string) (*NetworkPolicy, error) { vals := map[string]NetworkPolicy{ "azure": NetworkPolicyAzure, @@ -809,6 +1164,19 @@ func PossibleValuesForNodeOSUpgradeChannel() []string { } } +func (s *NodeOSUpgradeChannel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNodeOSUpgradeChannel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNodeOSUpgradeChannel(input string) (*NodeOSUpgradeChannel, error) { vals := map[string]NodeOSUpgradeChannel{ "nodeimage": NodeOSUpgradeChannelNodeImage, @@ -839,6 +1207,19 @@ func PossibleValuesForOSDiskType() []string { } } +func (s *OSDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSDiskType(input string) (*OSDiskType, error) { vals := map[string]OSDiskType{ "ephemeral": OSDiskTypeEphemeral, @@ -873,6 +1254,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "cblmariner": OSSKUCBLMariner, @@ -904,6 +1298,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -936,6 +1343,19 @@ func PossibleValuesForOutboundType() []string { } } +func (s *OutboundType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOutboundType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOutboundType(input string) (*OutboundType, error) { vals := map[string]OutboundType{ "loadbalancer": OutboundTypeLoadBalancer, @@ -966,6 +1386,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTCP, @@ -996,6 +1429,19 @@ func PossibleValuesForPublicNetworkAccess() []string { } } +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { vals := map[string]PublicNetworkAccess{ "disabled": PublicNetworkAccessDisabled, @@ -1025,6 +1471,19 @@ func PossibleValuesForRestrictionLevel() []string { } } +func (s *RestrictionLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestrictionLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseRestrictionLevel(input string) (*RestrictionLevel, error) { vals := map[string]RestrictionLevel{ "readonly": RestrictionLevelReadOnly, @@ -1053,6 +1512,19 @@ func PossibleValuesForScaleDownMode() []string { } } +func (s *ScaleDownMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleDownMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleDownMode(input string) (*ScaleDownMode, error) { vals := map[string]ScaleDownMode{ "deallocate": ScaleDownModeDeallocate, @@ -1081,6 +1553,19 @@ func PossibleValuesForScaleSetEvictionPolicy() []string { } } +func (s *ScaleSetEvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetEvictionPolicy(input string) (*ScaleSetEvictionPolicy, error) { vals := map[string]ScaleSetEvictionPolicy{ "deallocate": ScaleSetEvictionPolicyDeallocate, @@ -1109,6 +1594,19 @@ func PossibleValuesForScaleSetPriority() []string { } } +func (s *ScaleSetPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetPriority(input string) (*ScaleSetPriority, error) { vals := map[string]ScaleSetPriority{ "regular": ScaleSetPriorityRegular, @@ -1137,6 +1635,19 @@ func PossibleValuesForServiceMeshMode() []string { } } +func (s *ServiceMeshMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServiceMeshMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseServiceMeshMode(input string) (*ServiceMeshMode, error) { vals := map[string]ServiceMeshMode{ "disabled": ServiceMeshModeDisabled, @@ -1169,6 +1680,19 @@ func PossibleValuesForUpdateMode() []string { } } +func (s *UpdateMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpdateMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpdateMode(input string) (*UpdateMode, error) { vals := map[string]UpdateMode{ "auto": UpdateModeAuto, @@ -1205,6 +1729,19 @@ func PossibleValuesForUpgradeChannel() []string { } } +func (s *UpgradeChannel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeChannel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpgradeChannel(input string) (*UpgradeChannel, error) { vals := map[string]UpgradeChannel{ "node-image": UpgradeChannelNodeNegativeimage, @@ -1238,6 +1775,19 @@ func PossibleValuesForWorkloadRuntime() []string { } } +func (s *WorkloadRuntime) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadRuntime(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWorkloadRuntime(input string) (*WorkloadRuntime, error) { vals := map[string]WorkloadRuntime{ "katamshvvmisolation": WorkloadRuntimeKataMshvVMIsolation, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation.go new file mode 100644 index 000000000000..a37480f49c96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 AbortLatestOperationOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AbortLatestOperation ... +func (c ManagedClustersClient) AbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (result AbortLatestOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/abort", 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 +} + +// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed +func (c ManagedClustersClient) AbortLatestOperationThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.AbortLatestOperation(ctx, id) + if err != nil { + return fmt.Errorf("performing AbortLatestOperation: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AbortLatestOperation: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation_autorest.go deleted file mode 100644 index 76ae937e4883..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_abortlatestoperation_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 AbortLatestOperationOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AbortLatestOperation ... -func (c ManagedClustersClient) AbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (result AbortLatestOperationOperationResponse, err error) { - req, err := c.preparerForAbortLatestOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", nil, "Failure preparing request") - return - } - - result, err = c.senderForAbortLatestOperation(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed -func (c ManagedClustersClient) AbortLatestOperationThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.AbortLatestOperation(ctx, id) - if err != nil { - return fmt.Errorf("performing AbortLatestOperation: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AbortLatestOperation: %+v", err) - } - - return nil -} - -// preparerForAbortLatestOperation prepares the AbortLatestOperation request. -func (c ManagedClustersClient) preparerForAbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (*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/abort", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAbortLatestOperation sends the AbortLatestOperation request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForAbortLatestOperation(ctx context.Context, req *http.Request) (future AbortLatestOperationOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_createorupdate.go new file mode 100644 index 000000000000..c32d75d0be9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_createorupdate.go @@ -0,0 +1,76 @@ +package managedclusters + +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/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 + Model *ManagedCluster +} + +// CreateOrUpdate ... +func (c ManagedClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) 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/containerservice/2023-03-02-preview/managedclusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_createorupdate_autorest.go deleted file mode 100644 index 3a39a0803554..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_createorupdate_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *ManagedCluster -} - -// CreateOrUpdate ... -func (c ManagedClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ManagedClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) 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 ManagedClustersClient) preparerForCreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (*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 ManagedClustersClient) 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/containerservice/2023-03-02-preview/managedclusters/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_delete.go new file mode 100644 index 000000000000..53bf6a9ac7c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_delete.go @@ -0,0 +1,99 @@ +package managedclusters + +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/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 +} + +type DeleteOperationOptions struct { + IgnorePodDisruptionBudget *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IgnorePodDisruptionBudget != nil { + out.Append("ignore-pod-disruption-budget", fmt.Sprintf("%v", *o.IgnorePodDisruptionBudget)) + } + return &out +} + +// Delete ... +func (c ManagedClustersClient) Delete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-03-02-preview/managedclusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_delete_autorest.go deleted file mode 100644 index b6a15e70f3bd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_delete_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package managedclusters - -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" - "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 DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IgnorePodDisruptionBudget *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IgnorePodDisruptionBudget != nil { - out["ignore-pod-disruption-budget"] = *o.IgnorePodDisruptionBudget - } - - return out -} - -// Delete ... -func (c ManagedClustersClient) Delete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ManagedClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 ManagedClustersClient) preparerForDelete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 ManagedClustersClient) 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/containerservice/2023-03-02-preview/managedclusters/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_get.go new file mode 100644 index 000000000000..fe45d85e520e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_get.go @@ -0,0 +1,52 @@ +package managedclusters + +import ( + "context" + "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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// Get ... +func (c ManagedClustersClient) Get(ctx context.Context, id commonids.KubernetesClusterId) (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/containerservice/2023-03-02-preview/managedclusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_get_autorest.go deleted file mode 100644 index dd792998fed2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -import ( - "context" - "net/http" - - "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 GetOperationResponse struct { - HttpResponse *http.Response - Model *ManagedCluster -} - -// Get ... -func (c ManagedClustersClient) Get(ctx context.Context, id commonids.KubernetesClusterId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClustersClient) preparerForGet(ctx context.Context, id commonids.KubernetesClusterId) (*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 ManagedClustersClient) 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/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile.go new file mode 100644 index 000000000000..3aef3b2c7135 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile.go @@ -0,0 +1,52 @@ +package managedclusters + +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 GetAccessProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterAccessProfile +} + +// GetAccessProfile ... +func (c ManagedClustersClient) GetAccessProfile(ctx context.Context, id AccessProfileId) (result GetAccessProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listCredential", 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/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile_autorest.go deleted file mode 100644 index 82b7df70d16e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getaccessprofile_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -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 GetAccessProfileOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterAccessProfile -} - -// GetAccessProfile ... -func (c ManagedClustersClient) GetAccessProfile(ctx context.Context, id AccessProfileId) (result GetAccessProfileOperationResponse, err error) { - req, err := c.preparerForGetAccessProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAccessProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAccessProfile prepares the GetAccessProfile request. -func (c ManagedClustersClient) preparerForGetAccessProfile(ctx context.Context, id AccessProfileId) (*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/listCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAccessProfile handles the response to the GetAccessProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetAccessProfile(resp *http.Response) (result GetAccessProfileOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult.go new file mode 100644 index 000000000000..f1bd0c65255d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult.go @@ -0,0 +1,52 @@ +package managedclusters + +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 GetCommandResultOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// GetCommandResult ... +func (c ManagedClustersClient) GetCommandResult(ctx context.Context, id CommandResultId) (result GetCommandResultOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult_autorest.go deleted file mode 100644 index b5d9f095c1eb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getcommandresult_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclusters - -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 GetCommandResultOperationResponse struct { - HttpResponse *http.Response - Model *RunCommandResult -} - -// GetCommandResult ... -func (c ManagedClustersClient) GetCommandResult(ctx context.Context, id CommandResultId) (result GetCommandResultOperationResponse, err error) { - req, err := c.preparerForGetCommandResult(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetCommandResult(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetCommandResult prepares the GetCommandResult request. -func (c ManagedClustersClient) preparerForGetCommandResult(ctx context.Context, id CommandResultId) (*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)) -} - -// responderForGetCommandResult handles the response to the GetCommandResult request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetCommandResult(resp *http.Response) (result GetCommandResultOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions.go new file mode 100644 index 000000000000..88fd5581bc89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions.go @@ -0,0 +1,80 @@ +package managedclusters + +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 GetOSOptionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OSOptionProfile +} + +type GetOSOptionsOperationOptions struct { + ResourceType *string +} + +func DefaultGetOSOptionsOperationOptions() GetOSOptionsOperationOptions { + return GetOSOptionsOperationOptions{} +} + +func (o GetOSOptionsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOSOptionsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOSOptionsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ResourceType != nil { + out.Append("resource-type", fmt.Sprintf("%v", *o.ResourceType)) + } + return &out +} + +// GetOSOptions ... +func (c ManagedClustersClient) GetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (result GetOSOptionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/osOptions/default", 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/containerservice/2023-03-02-preview/managedclusters/method_getosoptions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions_autorest.go deleted file mode 100644 index 59f01e6d53f8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getosoptions_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package managedclusters - -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 GetOSOptionsOperationResponse struct { - HttpResponse *http.Response - Model *OSOptionProfile -} - -type GetOSOptionsOperationOptions struct { - ResourceType *string -} - -func DefaultGetOSOptionsOperationOptions() GetOSOptionsOperationOptions { - return GetOSOptionsOperationOptions{} -} - -func (o GetOSOptionsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOSOptionsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ResourceType != nil { - out["resource-type"] = *o.ResourceType - } - - return out -} - -// GetOSOptions ... -func (c ManagedClustersClient) GetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (result GetOSOptionsOperationResponse, err error) { - req, err := c.preparerForGetOSOptions(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetOSOptions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetOSOptions prepares the GetOSOptions request. -func (c ManagedClustersClient) preparerForGetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (*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/osOptions/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetOSOptions handles the response to the GetOSOptions request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetOSOptions(resp *http.Response) (result GetOSOptionsOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile.go new file mode 100644 index 000000000000..52c89ae8d473 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile.go @@ -0,0 +1,53 @@ +package managedclusters + +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 GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterUpgradeProfile +} + +// GetUpgradeProfile ... +func (c ManagedClustersClient) GetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/upgradeProfiles/default", 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/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile_autorest.go deleted file mode 100644 index cd10c7215b92..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_getupgradeprofile_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 GetUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterUpgradeProfile -} - -// GetUpgradeProfile ... -func (c ManagedClustersClient) GetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (result GetUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetUpgradeProfile prepares the GetUpgradeProfile request. -func (c ManagedClustersClient) preparerForGetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (*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/upgradeProfiles/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetUpgradeProfile handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetUpgradeProfile(resp *http.Response) (result GetUpgradeProfileOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list.go new file mode 100644 index 000000000000..17fb5e8fb680 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ManagedCluster +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// List ... +func (c ManagedClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/managedClusters", 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 *[]ManagedCluster `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 ManagedClustersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list_autorest.go deleted file mode 100644 index 871409d1963c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ManagedCluster -} - -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) -} - -// List ... -func (c ManagedClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ManagedClustersClient) preparerForList(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.ContainerService/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ManagedClustersClient) 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 ManagedClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedclusters.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ManagedCluster, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup.go new file mode 100644 index 000000000000..ee4658b5e0f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedclusters + +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 *[]ManagedCluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// ListByResourceGroup ... +func (c ManagedClustersClient) 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.ContainerService/managedClusters", 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 *[]ManagedCluster `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 ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedCluster, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup_autorest.go deleted file mode 100644 index bc961d43758e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedCluster -} - -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 ManagedClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClustersClient) 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.ContainerService/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClustersClient) 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 ManagedClustersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedclusters.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedCluster, 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/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials.go new file mode 100644 index 000000000000..1327fd22ff5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials.go @@ -0,0 +1,81 @@ +package managedclusters + +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 ListClusterAdminCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterAdminCredentialsOperationOptions struct { + ServerFqdn *string +} + +func DefaultListClusterAdminCredentialsOperationOptions() ListClusterAdminCredentialsOperationOptions { + return ListClusterAdminCredentialsOperationOptions{} +} + +func (o ListClusterAdminCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterAdminCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterAdminCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterAdminCredentials ... +func (c ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (result ListClusterAdminCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterAdminCredential", 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/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go deleted file mode 100644 index f8024c5b3075..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterAdminCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterAdminCredentialsOperationOptions struct { - ServerFqdn *string -} - -func DefaultListClusterAdminCredentialsOperationOptions() ListClusterAdminCredentialsOperationOptions { - return ListClusterAdminCredentialsOperationOptions{} -} - -func (o ListClusterAdminCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterAdminCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterAdminCredentials ... -func (c ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (result ListClusterAdminCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterAdminCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterAdminCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterAdminCredentials prepares the ListClusterAdminCredentials request. -func (c ManagedClustersClient) preparerForListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterAdminCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterAdminCredentials handles the response to the ListClusterAdminCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterAdminCredentials(resp *http.Response) (result ListClusterAdminCredentialsOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials.go new file mode 100644 index 000000000000..06110ff0a0f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials.go @@ -0,0 +1,81 @@ +package managedclusters + +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 ListClusterMonitoringUserCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterMonitoringUserCredentialsOperationOptions struct { + ServerFqdn *string +} + +func DefaultListClusterMonitoringUserCredentialsOperationOptions() ListClusterMonitoringUserCredentialsOperationOptions { + return ListClusterMonitoringUserCredentialsOperationOptions{} +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterMonitoringUserCredentials ... +func (c ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (result ListClusterMonitoringUserCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterMonitoringUserCredential", 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/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go deleted file mode 100644 index a7f62d3aff19..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterMonitoringUserCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterMonitoringUserCredentialsOperationOptions struct { - ServerFqdn *string -} - -func DefaultListClusterMonitoringUserCredentialsOperationOptions() ListClusterMonitoringUserCredentialsOperationOptions { - return ListClusterMonitoringUserCredentialsOperationOptions{} -} - -func (o ListClusterMonitoringUserCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterMonitoringUserCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterMonitoringUserCredentials ... -func (c ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (result ListClusterMonitoringUserCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterMonitoringUserCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterMonitoringUserCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterMonitoringUserCredentials prepares the ListClusterMonitoringUserCredentials request. -func (c ManagedClustersClient) preparerForListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterMonitoringUserCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterMonitoringUserCredentials handles the response to the ListClusterMonitoringUserCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterMonitoringUserCredentials(resp *http.Response) (result ListClusterMonitoringUserCredentialsOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials.go new file mode 100644 index 000000000000..e12b97e5b93f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials.go @@ -0,0 +1,85 @@ +package managedclusters + +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 ListClusterUserCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterUserCredentialsOperationOptions struct { + Format *Format + ServerFqdn *string +} + +func DefaultListClusterUserCredentialsOperationOptions() ListClusterUserCredentialsOperationOptions { + return ListClusterUserCredentialsOperationOptions{} +} + +func (o ListClusterUserCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterUserCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterUserCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterUserCredentials ... +func (c ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (result ListClusterUserCredentialsOperationResponse, 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()), + 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/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials_autorest.go deleted file mode 100644 index 0c90a5488c66..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listclusterusercredentials_autorest.go +++ /dev/null @@ -1,104 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterUserCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterUserCredentialsOperationOptions struct { - Format *Format - ServerFqdn *string -} - -func DefaultListClusterUserCredentialsOperationOptions() ListClusterUserCredentialsOperationOptions { - return ListClusterUserCredentialsOperationOptions{} -} - -func (o ListClusterUserCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterUserCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterUserCredentials ... -func (c ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (result ListClusterUserCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterUserCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterUserCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterUserCredentials prepares the ListClusterUserCredentials request. -func (c ManagedClustersClient) preparerForListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterUserCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterUserCredentials handles the response to the ListClusterUserCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterUserCredentials(resp *http.Response) (result ListClusterUserCredentialsOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions.go new file mode 100644 index 000000000000..17531ca71d9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions.go @@ -0,0 +1,52 @@ +package managedclusters + +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 ListKubernetesVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *KubernetesVersionListResult +} + +// ListKubernetesVersions ... +func (c ManagedClustersClient) ListKubernetesVersions(ctx context.Context, id LocationId) (result ListKubernetesVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/kubernetesVersions", 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/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions_autorest.go deleted file mode 100644 index 84984757ff18..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listkubernetesversions_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -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 ListKubernetesVersionsOperationResponse struct { - HttpResponse *http.Response - Model *KubernetesVersionListResult -} - -// ListKubernetesVersions ... -func (c ManagedClustersClient) ListKubernetesVersions(ctx context.Context, id LocationId) (result ListKubernetesVersionsOperationResponse, err error) { - req, err := c.preparerForListKubernetesVersions(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListKubernetesVersions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListKubernetesVersions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKubernetesVersions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListKubernetesVersions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKubernetesVersions prepares the ListKubernetesVersions request. -func (c ManagedClustersClient) preparerForListKubernetesVersions(ctx context.Context, id LocationId) (*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/kubernetesVersions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKubernetesVersions handles the response to the ListKubernetesVersions request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListKubernetesVersions(resp *http.Response) (result ListKubernetesVersionsOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go new file mode 100644 index 000000000000..759383196b88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OutboundEnvironmentEndpoint +} + +type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { + LatestHttpResponse *http.Response + Items []OutboundEnvironmentEndpoint +} + +// ListOutboundNetworkDependenciesEndpoints ... +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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 +} + +// ListOutboundNetworkDependenciesEndpointsComplete retrieves all the results into a single object +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate OutboundEnvironmentEndpointOperationPredicate) (result ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + resp, err := c.ListOutboundNetworkDependenciesEndpoints(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 = ListOutboundNetworkDependenciesEndpointsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go deleted file mode 100644 index c3db60df9284..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { - HttpResponse *http.Response - Model *[]OutboundEnvironmentEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOutboundNetworkDependenciesEndpointsOperationResponse, error) -} - -type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { - Items []OutboundEnvironmentEndpoint -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListOutboundNetworkDependenciesEndpoints ... -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListOutboundNetworkDependenciesEndpoints prepares the ListOutboundNetworkDependenciesEndpoints request. -func (c ManagedClustersClient) preparerForListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (*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)) -} - -// preparerForListOutboundNetworkDependenciesEndpointsWithNextLink prepares the ListOutboundNetworkDependenciesEndpoints request with the given nextLink token. -func (c ManagedClustersClient) preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(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)) -} - -// responderForListOutboundNetworkDependenciesEndpoints handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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 ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListOutboundNetworkDependenciesEndpoints(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { - return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) -} - -// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { - items := make([]OutboundEnvironmentEndpoint, 0) - - page, err := c.ListOutboundNetworkDependenciesEndpoints(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 := ListOutboundNetworkDependenciesEndpointsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile.go new file mode 100644 index 000000000000..abdbb59c0189 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 ResetAADProfileOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ResetAADProfile ... +func (c ManagedClustersClient) ResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (result ResetAADProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resetAADProfile", 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 +} + +// ResetAADProfileThenPoll performs ResetAADProfile then polls until it's completed +func (c ManagedClustersClient) ResetAADProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) error { + result, err := c.ResetAADProfile(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ResetAADProfile: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ResetAADProfile: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile_autorest.go deleted file mode 100644 index 5c43129a602b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetaadprofile_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedclusters - -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" - "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 ResetAADProfileOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ResetAADProfile ... -func (c ManagedClustersClient) ResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (result ResetAADProfileOperationResponse, err error) { - req, err := c.preparerForResetAADProfile(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") - return - } - - result, err = c.senderForResetAADProfile(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetAADProfile", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetAADProfileThenPoll performs ResetAADProfile then polls until it's completed -func (c ManagedClustersClient) ResetAADProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) error { - result, err := c.ResetAADProfile(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ResetAADProfile: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ResetAADProfile: %+v", err) - } - - return nil -} - -// preparerForResetAADProfile prepares the ResetAADProfile request. -func (c ManagedClustersClient) preparerForResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (*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/resetAADProfile", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResetAADProfile sends the ResetAADProfile request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForResetAADProfile(ctx context.Context, req *http.Request) (future ResetAADProfileOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile.go new file mode 100644 index 000000000000..54589acaf039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 ResetServicePrincipalProfileOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ResetServicePrincipalProfile ... +func (c ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (result ResetServicePrincipalProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resetServicePrincipalProfile", 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 +} + +// ResetServicePrincipalProfileThenPoll performs ResetServicePrincipalProfile then polls until it's completed +func (c ManagedClustersClient) ResetServicePrincipalProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) error { + result, err := c.ResetServicePrincipalProfile(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ResetServicePrincipalProfile: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ResetServicePrincipalProfile: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go deleted file mode 100644 index 874e24031409..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedclusters - -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" - "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 ResetServicePrincipalProfileOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ResetServicePrincipalProfile ... -func (c ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (result ResetServicePrincipalProfileOperationResponse, err error) { - req, err := c.preparerForResetServicePrincipalProfile(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") - return - } - - result, err = c.senderForResetServicePrincipalProfile(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetServicePrincipalProfile", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetServicePrincipalProfileThenPoll performs ResetServicePrincipalProfile then polls until it's completed -func (c ManagedClustersClient) ResetServicePrincipalProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) error { - result, err := c.ResetServicePrincipalProfile(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ResetServicePrincipalProfile: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ResetServicePrincipalProfile: %+v", err) - } - - return nil -} - -// preparerForResetServicePrincipalProfile prepares the ResetServicePrincipalProfile request. -func (c ManagedClustersClient) preparerForResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (*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/resetServicePrincipalProfile", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResetServicePrincipalProfile sends the ResetServicePrincipalProfile request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForResetServicePrincipalProfile(ctx context.Context, req *http.Request) (future ResetServicePrincipalProfileOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates.go new file mode 100644 index 000000000000..3d04938f645d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 RotateClusterCertificatesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RotateClusterCertificates ... +func (c ManagedClustersClient) RotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (result RotateClusterCertificatesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rotateClusterCertificates", 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 +} + +// RotateClusterCertificatesThenPoll performs RotateClusterCertificates then polls until it's completed +func (c ManagedClustersClient) RotateClusterCertificatesThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.RotateClusterCertificates(ctx, id) + if err != nil { + return fmt.Errorf("performing RotateClusterCertificates: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RotateClusterCertificates: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates_autorest.go deleted file mode 100644 index 3dbf6a18a04e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateclustercertificates_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 RotateClusterCertificatesOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RotateClusterCertificates ... -func (c ManagedClustersClient) RotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (result RotateClusterCertificatesOperationResponse, err error) { - req, err := c.preparerForRotateClusterCertificates(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") - return - } - - result, err = c.senderForRotateClusterCertificates(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateClusterCertificates", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RotateClusterCertificatesThenPoll performs RotateClusterCertificates then polls until it's completed -func (c ManagedClustersClient) RotateClusterCertificatesThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.RotateClusterCertificates(ctx, id) - if err != nil { - return fmt.Errorf("performing RotateClusterCertificates: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RotateClusterCertificates: %+v", err) - } - - return nil -} - -// preparerForRotateClusterCertificates prepares the RotateClusterCertificates request. -func (c ManagedClustersClient) preparerForRotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (*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/rotateClusterCertificates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRotateClusterCertificates sends the RotateClusterCertificates request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRotateClusterCertificates(ctx context.Context, req *http.Request) (future RotateClusterCertificatesOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go new file mode 100644 index 000000000000..b4cecc16d857 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 RotateServiceAccountSigningKeysOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RotateServiceAccountSigningKeys ... +func (c ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (result RotateServiceAccountSigningKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rotateServiceAccountSigningKeys", 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 +} + +// RotateServiceAccountSigningKeysThenPoll performs RotateServiceAccountSigningKeys then polls until it's completed +func (c ManagedClustersClient) RotateServiceAccountSigningKeysThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.RotateServiceAccountSigningKeys(ctx, id) + if err != nil { + return fmt.Errorf("performing RotateServiceAccountSigningKeys: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RotateServiceAccountSigningKeys: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go deleted file mode 100644 index d0806cb35c67..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 RotateServiceAccountSigningKeysOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RotateServiceAccountSigningKeys ... -func (c ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (result RotateServiceAccountSigningKeysOperationResponse, err error) { - req, err := c.preparerForRotateServiceAccountSigningKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateServiceAccountSigningKeys", nil, "Failure preparing request") - return - } - - result, err = c.senderForRotateServiceAccountSigningKeys(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateServiceAccountSigningKeys", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RotateServiceAccountSigningKeysThenPoll performs RotateServiceAccountSigningKeys then polls until it's completed -func (c ManagedClustersClient) RotateServiceAccountSigningKeysThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.RotateServiceAccountSigningKeys(ctx, id) - if err != nil { - return fmt.Errorf("performing RotateServiceAccountSigningKeys: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RotateServiceAccountSigningKeys: %+v", err) - } - - return nil -} - -// preparerForRotateServiceAccountSigningKeys prepares the RotateServiceAccountSigningKeys request. -func (c ManagedClustersClient) preparerForRotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (*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/rotateServiceAccountSigningKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRotateServiceAccountSigningKeys sends the RotateServiceAccountSigningKeys request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRotateServiceAccountSigningKeys(ctx context.Context, req *http.Request) (future RotateServiceAccountSigningKeysOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_runcommand.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand.go new file mode 100644 index 000000000000..b64b4ec1b204 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand.go @@ -0,0 +1,76 @@ +package managedclusters + +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/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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c ManagedClustersClient) RunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c ManagedClustersClient) RunCommandThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand_autorest.go deleted file mode 100644 index 52b3f6831890..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_runcommand_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 RunCommandOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *RunCommandResult -} - -// RunCommand ... -func (c ManagedClustersClient) RunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (result RunCommandOperationResponse, err error) { - req, err := c.preparerForRunCommand(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RunCommand", nil, "Failure preparing request") - return - } - - result, err = c.senderForRunCommand(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RunCommand", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RunCommandThenPoll performs RunCommand then polls until it's completed -func (c ManagedClustersClient) RunCommandThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) error { - result, err := c.RunCommand(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RunCommand: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RunCommand: %+v", err) - } - - return nil -} - -// preparerForRunCommand prepares the RunCommand request. -func (c ManagedClustersClient) preparerForRunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (*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/runCommand", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRunCommand sends the RunCommand request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRunCommand(ctx context.Context, req *http.Request) (future RunCommandOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start.go new file mode 100644 index 000000000000..ba4549e76155 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c ManagedClustersClient) Start(ctx context.Context, id commonids.KubernetesClusterId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c ManagedClustersClient) StartThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start_autorest.go deleted file mode 100644 index 523cd6864891..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_start_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Start ... -func (c ManagedClustersClient) Start(ctx context.Context, id commonids.KubernetesClusterId) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c ManagedClustersClient) StartThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.Start(ctx, id) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c ManagedClustersClient) preparerForStart(ctx context.Context, id commonids.KubernetesClusterId) (*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/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop.go new file mode 100644 index 000000000000..3bec609e3b46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Stop ... +func (c ManagedClustersClient) Stop(ctx context.Context, id commonids.KubernetesClusterId) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", 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 +} + +// StopThenPoll performs Stop then polls until it's completed +func (c ManagedClustersClient) StopThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop_autorest.go deleted file mode 100644 index ecd7e737a40d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_stop_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Stop ... -func (c ManagedClustersClient) Stop(ctx context.Context, id commonids.KubernetesClusterId) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c ManagedClustersClient) StopThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.Stop(ctx, id) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c ManagedClustersClient) preparerForStop(ctx context.Context, id commonids.KubernetesClusterId) (*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/stop", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, 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/containerservice/2023-03-02-preview/managedclusters/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags.go new file mode 100644 index 000000000000..1ed48544bf91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 UpdateTagsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// UpdateTags ... +func (c ManagedClustersClient) UpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (result UpdateTagsOperationResponse, 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 +} + +// UpdateTagsThenPoll performs UpdateTags then polls until it's completed +func (c ManagedClustersClient) UpdateTagsThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) error { + result, err := c.UpdateTags(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateTags: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateTags: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags_autorest.go deleted file mode 100644 index 6b582645a14c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclusters/method_updatetags_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 UpdateTagsOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *ManagedCluster -} - -// UpdateTags ... -func (c ManagedClustersClient) UpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdateTags(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateTagsThenPoll performs UpdateTags then polls until it's completed -func (c ManagedClustersClient) UpdateTagsThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) error { - result, err := c.UpdateTags(ctx, id, input) - if err != nil { - return fmt.Errorf("performing UpdateTags: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after UpdateTags: %+v", err) - } - - return nil -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c ManagedClustersClient) preparerForUpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (*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)) -} - -// senderForUpdateTags sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForUpdateTags(ctx context.Context, req *http.Request) (future UpdateTagsOperationResponse, 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/containerservice/2023-03-02-preview/managedclustersnapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/client.go index cf2e2f098d7e..939ebd0b9843 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/client.go @@ -1,18 +1,26 @@ package managedclustersnapshots -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 ManagedClusterSnapshotsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedClusterSnapshotsClientWithBaseURI(endpoint string) ManagedClusterSnapshotsClient { - return ManagedClusterSnapshotsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedClusterSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedClusterSnapshotsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedclustersnapshots", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedClusterSnapshotsClient: %+v", err) } + + return &ManagedClusterSnapshotsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/constants.go index 4b599933b113..c65f5433e0b0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/constants.go @@ -1,6 +1,10 @@ package managedclustersnapshots -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 PossibleValuesForLoadBalancerSku() []string { } } +func (s *LoadBalancerSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoadBalancerSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoadBalancerSku(input string) (*LoadBalancerSku, error) { vals := map[string]LoadBalancerSku{ "basic": LoadBalancerSkuBasic, @@ -45,6 +62,19 @@ func PossibleValuesForManagedClusterSKUName() []string { } } +func (s *ManagedClusterSKUName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUName(input string) (*ManagedClusterSKUName, error) { vals := map[string]ManagedClusterSKUName{ "base": ManagedClusterSKUNameBase, @@ -74,6 +104,19 @@ func PossibleValuesForManagedClusterSKUTier() []string { } } +func (s *ManagedClusterSKUTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUTier(input string) (*ManagedClusterSKUTier, error) { vals := map[string]ManagedClusterSKUTier{ "free": ManagedClusterSKUTierFree, @@ -103,6 +146,19 @@ func PossibleValuesForNetworkMode() []string { } } +func (s *NetworkMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkMode(input string) (*NetworkMode, error) { vals := map[string]NetworkMode{ "bridge": NetworkModeBridge, @@ -133,6 +189,19 @@ func PossibleValuesForNetworkPlugin() []string { } } +func (s *NetworkPlugin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPlugin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPlugin(input string) (*NetworkPlugin, error) { vals := map[string]NetworkPlugin{ "azure": NetworkPluginAzure, @@ -160,6 +229,19 @@ func PossibleValuesForNetworkPluginMode() []string { } } +func (s *NetworkPluginMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPluginMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPluginMode(input string) (*NetworkPluginMode, error) { vals := map[string]NetworkPluginMode{ "overlay": NetworkPluginModeOverlay, @@ -189,6 +271,19 @@ func PossibleValuesForNetworkPolicy() []string { } } +func (s *NetworkPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPolicy(input string) (*NetworkPolicy, error) { vals := map[string]NetworkPolicy{ "azure": NetworkPolicyAzure, @@ -218,6 +313,19 @@ func PossibleValuesForSnapshotType() []string { } } +func (s *SnapshotType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSnapshotType(input string) (*SnapshotType, error) { vals := map[string]SnapshotType{ "managedcluster": SnapshotTypeManagedCluster, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate.go new file mode 100644 index 000000000000..8ea018ea457a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate.go @@ -0,0 +1,56 @@ +package managedclustersnapshots + +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 *ManagedClusterSnapshot +} + +// CreateOrUpdate ... +func (c ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, id ManagedClusterSnapshotId, input ManagedClusterSnapshot) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate_autorest.go deleted file mode 100644 index d233c363c67f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclustersnapshots - -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 *ManagedClusterSnapshot -} - -// CreateOrUpdate ... -func (c ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, id ManagedClusterSnapshotId, input ManagedClusterSnapshot) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ManagedClusterSnapshotsClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedClusterSnapshotId, input ManagedClusterSnapshot) (*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 ManagedClusterSnapshotsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete.go new file mode 100644 index 000000000000..3b8fc26cc156 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete.go @@ -0,0 +1,47 @@ +package managedclustersnapshots + +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 ManagedClusterSnapshotsClient) Delete(ctx context.Context, id ManagedClusterSnapshotId) (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/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete_autorest.go deleted file mode 100644 index c5c5ab24ba5e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package managedclustersnapshots - -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 ManagedClusterSnapshotsClient) Delete(ctx context.Context, id ManagedClusterSnapshotId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ManagedClusterSnapshotsClient) preparerForDelete(ctx context.Context, id ManagedClusterSnapshotId) (*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 ManagedClusterSnapshotsClient) 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/containerservice/2023-03-02-preview/managedclustersnapshots/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_get.go new file mode 100644 index 000000000000..1fb5543f3c38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_get.go @@ -0,0 +1,51 @@ +package managedclustersnapshots + +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 *ManagedClusterSnapshot +} + +// Get ... +func (c ManagedClusterSnapshotsClient) Get(ctx context.Context, id ManagedClusterSnapshotId) (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/containerservice/2023-03-02-preview/managedclustersnapshots/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_get_autorest.go deleted file mode 100644 index 9fba067e0a72..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclustersnapshots - -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 *ManagedClusterSnapshot -} - -// Get ... -func (c ManagedClusterSnapshotsClient) Get(ctx context.Context, id ManagedClusterSnapshotId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClusterSnapshotsClient) preparerForGet(ctx context.Context, id ManagedClusterSnapshotId) (*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 ManagedClusterSnapshotsClient) 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/containerservice/2023-03-02-preview/managedclustersnapshots/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list.go new file mode 100644 index 000000000000..9f0d4dec6996 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list.go @@ -0,0 +1,92 @@ +package managedclustersnapshots + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ManagedClusterSnapshot +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedClusterSnapshot +} + +// List ... +func (c ManagedClusterSnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/managedClusterSnapshots", 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 *[]ManagedClusterSnapshot `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 ManagedClusterSnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClusterSnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterSnapshotOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ManagedClusterSnapshot, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list_autorest.go deleted file mode 100644 index 19f3b342c53f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclustersnapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ManagedClusterSnapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ManagedClusterSnapshot -} - -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) -} - -// List ... -func (c ManagedClusterSnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ManagedClusterSnapshotsClient) preparerForList(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.ContainerService/managedClusterSnapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ManagedClusterSnapshotsClient) 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 ManagedClusterSnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ManagedClusterSnapshot `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, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ManagedClusterSnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterSnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterSnapshotOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ManagedClusterSnapshot, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup.go new file mode 100644 index 000000000000..4b28f6c8a057 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedclustersnapshots + +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 *[]ManagedClusterSnapshot +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedClusterSnapshot +} + +// ListByResourceGroup ... +func (c ManagedClusterSnapshotsClient) 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.ContainerService/managedClusterSnapshots", 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 *[]ManagedClusterSnapshot `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 ManagedClusterSnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClusterSnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterSnapshotOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedClusterSnapshot, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 4b10b8734d1e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclustersnapshots - -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 *[]ManagedClusterSnapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedClusterSnapshot -} - -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 ManagedClusterSnapshotsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClusterSnapshotsClient) 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.ContainerService/managedClusterSnapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClusterSnapshotsClient) 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 ManagedClusterSnapshotsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ManagedClusterSnapshot `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, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClusterSnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterSnapshotOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterSnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterSnapshotOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedClusterSnapshot, 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/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags.go new file mode 100644 index 000000000000..050b9d5e3c31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags.go @@ -0,0 +1,55 @@ +package managedclustersnapshots + +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 UpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterSnapshot +} + +// UpdateTags ... +func (c ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, id ManagedClusterSnapshotId, input TagsObject) (result UpdateTagsOperationResponse, 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/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags_autorest.go deleted file mode 100644 index 2f431e58362a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/method_updatetags_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclustersnapshots - -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 UpdateTagsOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterSnapshot -} - -// UpdateTags ... -func (c ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, id ManagedClusterSnapshotId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdateTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclustersnapshots.ManagedClusterSnapshotsClient", "UpdateTags", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c ManagedClusterSnapshotsClient) preparerForUpdateTags(ctx context.Context, id ManagedClusterSnapshotId, input TagsObject) (*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)) -} - -// responderForUpdateTags handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (c ManagedClusterSnapshotsClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, 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/containerservice/2023-03-02-preview/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/client.go index 1de584406fe4..3bf7a6afe1ff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/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/containerservice/2023-03-02-preview/privateendpointconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/constants.go index 5a68b40f7bea..20cf74bcad41 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/constants.go @@ -1,6 +1,10 @@ package privateendpointconnections -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. @@ -23,6 +27,19 @@ func PossibleValuesForConnectionStatus() []string { } } +func (s *ConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectionStatus(input string) (*ConnectionStatus, error) { vals := map[string]ConnectionStatus{ "approved": ConnectionStatusApproved, @@ -59,6 +76,19 @@ func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { } } +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { vals := map[string]PrivateEndpointConnectionProvisioningState{ "canceled": PrivateEndpointConnectionProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_delete.go new file mode 100644 index 000000000000..2b9a343bdf02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_delete.go @@ -0,0 +1,70 @@ +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.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/containerservice/2023-03-02-preview/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_delete_autorest.go deleted file mode 100644 index ef4fd3d8e664..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/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/containerservice/2023-03-02-preview/privateendpointconnections/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_get.go new file mode 100644 index 000000000000..6aeba2f77f92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/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/containerservice/2023-03-02-preview/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_get_autorest.go deleted file mode 100644 index 44bbdcb8f0bf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/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/containerservice/2023-03-02-preview/privateendpointconnections/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_list.go new file mode 100644 index 000000000000..d996c0de2d9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_list.go @@ -0,0 +1,53 @@ +package privateendpointconnections + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnectionListResult +} + +// List ... +func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, 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.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/containerservice/2023-03-02-preview/privateendpointconnections/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_list_autorest.go deleted file mode 100644 index e2eaeb5697bc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_list_autorest.go +++ /dev/null @@ -1,70 +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/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 ListOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnectionListResult -} - -// List ... -func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", 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", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c PrivateEndpointConnectionsClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/containerservice/2023-03-02-preview/privateendpointconnections/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_update.go new file mode 100644 index 000000000000..042bf85090eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_update.go @@ -0,0 +1,55 @@ +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// Update ... +func (c PrivateEndpointConnectionsClient) Update(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result UpdateOperationResponse, 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/containerservice/2023-03-02-preview/privateendpointconnections/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_update_autorest.go deleted file mode 100644 index a2c450c04823..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/method_update_autorest.go +++ /dev/null @@ -1,69 +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 UpdateOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// Update ... -func (c PrivateEndpointConnectionsClient) Update(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", 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", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c PrivateEndpointConnectionsClient) preparerForUpdate(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)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) 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/containerservice/2023-03-02-preview/privatelinkresources/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/client.go index 5f532940700f..e6e22caa7468 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/client.go @@ -1,18 +1,26 @@ package privatelinkresources -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 PrivateLinkResourcesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(endpoint string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPrivateLinkResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkResourcesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "privatelinkresources", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) } + + return &PrivateLinkResourcesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list.go new file mode 100644 index 000000000000..6bd58b383e4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list.go @@ -0,0 +1,53 @@ +package privatelinkresources + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResourcesListResult +} + +// List ... +func (c PrivateLinkResourcesClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateLinkResources", 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/containerservice/2023-03-02-preview/privatelinkresources/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list_autorest.go deleted file mode 100644 index 978d829230a5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/privatelinkresources/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package privatelinkresources - -import ( - "context" - "fmt" - "net/http" - - "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 ListOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResourcesListResult -} - -// List ... -func (c PrivateLinkResourcesClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c PrivateLinkResourcesClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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/privateLinkResources", id.ID())), - 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 PrivateLinkResourcesClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/client.go index ba3d29ae6f0d..dd21ffc0b6b5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/client.go @@ -1,18 +1,26 @@ package resolveprivatelinkserviceid -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 ResolvePrivateLinkServiceIdClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewResolvePrivateLinkServiceIdClientWithBaseURI(endpoint string) ResolvePrivateLinkServiceIdClient { - return ResolvePrivateLinkServiceIdClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewResolvePrivateLinkServiceIdClientWithBaseURI(sdkApi sdkEnv.Api) (*ResolvePrivateLinkServiceIdClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "resolveprivatelinkserviceid", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ResolvePrivateLinkServiceIdClient: %+v", err) } + + return &ResolvePrivateLinkServiceIdClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post.go new file mode 100644 index 000000000000..9b36ee0f1734 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post.go @@ -0,0 +1,57 @@ +package resolveprivatelinkserviceid + +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 POSTOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResource +} + +// POST ... +func (c ResolvePrivateLinkServiceIdClient) POST(ctx context.Context, id commonids.KubernetesClusterId, input PrivateLinkResource) (result POSTOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resolvePrivateLinkServiceId", 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/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post_autorest.go deleted file mode 100644 index 8f98c5958a5d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/resolveprivatelinkserviceid/method_post_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package resolveprivatelinkserviceid - -import ( - "context" - "fmt" - "net/http" - - "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 POSTOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResource -} - -// POST ... -func (c ResolvePrivateLinkServiceIdClient) POST(ctx context.Context, id commonids.KubernetesClusterId, input PrivateLinkResource) (result POSTOperationResponse, err error) { - req, err := c.preparerForPOST(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "resolveprivatelinkserviceid.ResolvePrivateLinkServiceIdClient", "POST", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "resolveprivatelinkserviceid.ResolvePrivateLinkServiceIdClient", "POST", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPOST(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "resolveprivatelinkserviceid.ResolvePrivateLinkServiceIdClient", "POST", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPOST prepares the POST request. -func (c ResolvePrivateLinkServiceIdClient) preparerForPOST(ctx context.Context, id commonids.KubernetesClusterId, input PrivateLinkResource) (*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/resolvePrivateLinkServiceId", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPOST handles the response to the POST request. The method always -// closes the http.Response Body. -func (c ResolvePrivateLinkServiceIdClient) responderForPOST(resp *http.Response) (result POSTOperationResponse, 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/containerservice/2023-03-02-preview/snapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/client.go index 62d2a1323835..620b7900eab7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/client.go @@ -1,18 +1,26 @@ package snapshots -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 SnapshotsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSnapshotsClientWithBaseURI(endpoint string) SnapshotsClient { - return SnapshotsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) } + + return &SnapshotsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/constants.go index 69ba232110a1..74b099079a0c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/constants.go @@ -1,6 +1,10 @@ package snapshots -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. @@ -25,6 +29,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "cblmariner": OSSKUCBLMariner, @@ -56,6 +73,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -84,6 +114,19 @@ func PossibleValuesForSnapshotType() []string { } } +func (s *SnapshotType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSnapshotType(input string) (*SnapshotType, error) { vals := map[string]SnapshotType{ "managedcluster": SnapshotTypeManagedCluster, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate.go new file mode 100644 index 000000000000..dc9a67647604 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate.go @@ -0,0 +1,56 @@ +package snapshots + +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 *Snapshot +} + +// CreateOrUpdate ... +func (c SnapshotsClient) CreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-03-02-preview/snapshots/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate_autorest.go deleted file mode 100644 index 29d10e44f6e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// CreateOrUpdate ... -func (c SnapshotsClient) CreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SnapshotsClient) preparerForCreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (*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 SnapshotsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-03-02-preview/snapshots/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_delete.go new file mode 100644 index 000000000000..575cb8a6929b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_delete.go @@ -0,0 +1,47 @@ +package snapshots + +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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (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/containerservice/2023-03-02-preview/snapshots/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_delete_autorest.go deleted file mode 100644 index 11173f290039..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c SnapshotsClient) preparerForDelete(ctx context.Context, id SnapshotId) (*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 SnapshotsClient) 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/containerservice/2023-03-02-preview/snapshots/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_get.go new file mode 100644 index 000000000000..4f024ded4736 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_get.go @@ -0,0 +1,51 @@ +package snapshots + +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 *Snapshot +} + +// Get ... +func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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/containerservice/2023-03-02-preview/snapshots/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_get_autorest.go deleted file mode 100644 index b328ad1cf52e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SnapshotsClient) preparerForGet(ctx context.Context, id SnapshotId) (*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 SnapshotsClient) 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/containerservice/2023-03-02-preview/snapshots/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list.go new file mode 100644 index 000000000000..bdefce6bb904 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list.go @@ -0,0 +1,92 @@ +package snapshots + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Snapshot +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Snapshot +} + +// List ... +func (c SnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/snapshots", 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 *[]Snapshot `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 SnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SnapshotOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Snapshot, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list_autorest.go deleted file mode 100644 index 6222a23b06d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]Snapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []Snapshot -} - -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) -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c SnapshotsClient) preparerForList(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.ContainerService/snapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c SnapshotsClient) 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 SnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []Snapshot `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, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c SnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SnapshotOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]Snapshot, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup.go new file mode 100644 index 000000000000..824b8dc7cb6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package snapshots + +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 *[]Snapshot +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Snapshot +} + +// ListByResourceGroup ... +func (c SnapshotsClient) 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.ContainerService/snapshots", 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 *[]Snapshot `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 SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SnapshotOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Snapshot, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f034336ecfe8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package snapshots - -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 *[]Snapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Snapshot -} - -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 SnapshotsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c SnapshotsClient) 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.ContainerService/snapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c SnapshotsClient) 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 SnapshotsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Snapshot `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, "snapshots.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SnapshotOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Snapshot, 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/containerservice/2023-03-02-preview/snapshots/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_updatetags.go new file mode 100644 index 000000000000..19bbc0cf0e74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_updatetags.go @@ -0,0 +1,55 @@ +package snapshots + +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 UpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Snapshot +} + +// UpdateTags ... +func (c SnapshotsClient) UpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (result UpdateTagsOperationResponse, 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/containerservice/2023-03-02-preview/snapshots/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_updatetags_autorest.go deleted file mode 100644 index e370c6b54a58..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/snapshots/method_updatetags_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package snapshots - -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 UpdateTagsOperationResponse struct { - HttpResponse *http.Response - Model *Snapshot -} - -// UpdateTags ... -func (c SnapshotsClient) UpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdateTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c SnapshotsClient) preparerForUpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (*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)) -} - -// responderForUpdateTags handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (c SnapshotsClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/client.go index b90dc2eff20b..3478bfc5e372 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/client.go @@ -1,18 +1,26 @@ package trustedaccess -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 TrustedAccessClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTrustedAccessClientWithBaseURI(endpoint string) TrustedAccessClient { - return TrustedAccessClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTrustedAccessClientWithBaseURI(sdkApi sdkEnv.Api) (*TrustedAccessClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "trustedaccess", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TrustedAccessClient: %+v", err) } + + return &TrustedAccessClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/constants.go index e1f9de58d445..8ab993f971c7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/constants.go @@ -1,6 +1,10 @@ package trustedaccess -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. @@ -25,6 +29,19 @@ func PossibleValuesForTrustedAccessRoleBindingProvisioningState() []string { } } +func (s *TrustedAccessRoleBindingProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTrustedAccessRoleBindingProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTrustedAccessRoleBindingProvisioningState(input string) (*TrustedAccessRoleBindingProvisioningState, error) { vals := map[string]TrustedAccessRoleBindingProvisioningState{ "canceled": TrustedAccessRoleBindingProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate.go new file mode 100644 index 000000000000..652e336e8bd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate.go @@ -0,0 +1,55 @@ +package trustedaccess + +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 RoleBindingsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TrustedAccessRoleBinding +} + +// RoleBindingsCreateOrUpdate ... +func (c TrustedAccessClient) RoleBindingsCreateOrUpdate(ctx context.Context, id TrustedAccessRoleBindingId, input TrustedAccessRoleBinding) (result RoleBindingsCreateOrUpdateOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go deleted file mode 100644 index 366863993642..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package trustedaccess - -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 RoleBindingsCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *TrustedAccessRoleBinding -} - -// RoleBindingsCreateOrUpdate ... -func (c TrustedAccessClient) RoleBindingsCreateOrUpdate(ctx context.Context, id TrustedAccessRoleBindingId, input TrustedAccessRoleBinding) (result RoleBindingsCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForRoleBindingsCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRoleBindingsCreateOrUpdate prepares the RoleBindingsCreateOrUpdate request. -func (c TrustedAccessClient) preparerForRoleBindingsCreateOrUpdate(ctx context.Context, id TrustedAccessRoleBindingId, input TrustedAccessRoleBinding) (*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)) -} - -// responderForRoleBindingsCreateOrUpdate handles the response to the RoleBindingsCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsCreateOrUpdate(resp *http.Response) (result RoleBindingsCreateOrUpdateOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete.go new file mode 100644 index 000000000000..6f782d1a92c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete.go @@ -0,0 +1,47 @@ +package trustedaccess + +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 RoleBindingsDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RoleBindingsDelete ... +func (c TrustedAccessClient) RoleBindingsDelete(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsDeleteOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go deleted file mode 100644 index 7e088ee71ce8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package trustedaccess - -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 RoleBindingsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// RoleBindingsDelete ... -func (c TrustedAccessClient) RoleBindingsDelete(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsDeleteOperationResponse, err error) { - req, err := c.preparerForRoleBindingsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRoleBindingsDelete prepares the RoleBindingsDelete request. -func (c TrustedAccessClient) preparerForRoleBindingsDelete(ctx context.Context, id TrustedAccessRoleBindingId) (*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)) -} - -// responderForRoleBindingsDelete handles the response to the RoleBindingsDelete request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsDelete(resp *http.Response) (result RoleBindingsDeleteOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget.go new file mode 100644 index 000000000000..f54366185d52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget.go @@ -0,0 +1,51 @@ +package trustedaccess + +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 RoleBindingsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TrustedAccessRoleBinding +} + +// RoleBindingsGet ... +func (c TrustedAccessClient) RoleBindingsGet(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsGetOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget_autorest.go deleted file mode 100644 index c51acc2a35e4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package trustedaccess - -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 RoleBindingsGetOperationResponse struct { - HttpResponse *http.Response - Model *TrustedAccessRoleBinding -} - -// RoleBindingsGet ... -func (c TrustedAccessClient) RoleBindingsGet(ctx context.Context, id TrustedAccessRoleBindingId) (result RoleBindingsGetOperationResponse, err error) { - req, err := c.preparerForRoleBindingsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRoleBindingsGet prepares the RoleBindingsGet request. -func (c TrustedAccessClient) preparerForRoleBindingsGet(ctx context.Context, id TrustedAccessRoleBindingId) (*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)) -} - -// responderForRoleBindingsGet handles the response to the RoleBindingsGet request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsGet(resp *http.Response) (result RoleBindingsGetOperationResponse, 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/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist.go new file mode 100644 index 000000000000..4fc3b544dc01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist.go @@ -0,0 +1,92 @@ +package trustedaccess + +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 RoleBindingsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TrustedAccessRoleBinding +} + +type RoleBindingsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []TrustedAccessRoleBinding +} + +// RoleBindingsList ... +func (c TrustedAccessClient) RoleBindingsList(ctx context.Context, id commonids.KubernetesClusterId) (result RoleBindingsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/trustedAccessRoleBindings", 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 *[]TrustedAccessRoleBinding `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// RoleBindingsListComplete retrieves all the results into a single object +func (c TrustedAccessClient) RoleBindingsListComplete(ctx context.Context, id commonids.KubernetesClusterId) (RoleBindingsListCompleteResult, error) { + return c.RoleBindingsListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleBindingOperationPredicate{}) +} + +// RoleBindingsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TrustedAccessClient) RoleBindingsListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate TrustedAccessRoleBindingOperationPredicate) (result RoleBindingsListCompleteResult, err error) { + items := make([]TrustedAccessRoleBinding, 0) + + resp, err := c.RoleBindingsList(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 = RoleBindingsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist_autorest.go deleted file mode 100644 index 0358b505cbc7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_rolebindingslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package trustedaccess - -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 RoleBindingsListOperationResponse struct { - HttpResponse *http.Response - Model *[]TrustedAccessRoleBinding - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (RoleBindingsListOperationResponse, error) -} - -type RoleBindingsListCompleteResult struct { - Items []TrustedAccessRoleBinding -} - -func (r RoleBindingsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r RoleBindingsListOperationResponse) LoadMore(ctx context.Context) (resp RoleBindingsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// RoleBindingsList ... -func (c TrustedAccessClient) RoleBindingsList(ctx context.Context, id commonids.KubernetesClusterId) (resp RoleBindingsListOperationResponse, err error) { - req, err := c.preparerForRoleBindingsList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForRoleBindingsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForRoleBindingsList prepares the RoleBindingsList request. -func (c TrustedAccessClient) preparerForRoleBindingsList(ctx context.Context, id commonids.KubernetesClusterId) (*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/trustedAccessRoleBindings", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForRoleBindingsListWithNextLink prepares the RoleBindingsList request with the given nextLink token. -func (c TrustedAccessClient) preparerForRoleBindingsListWithNextLink(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)) -} - -// responderForRoleBindingsList handles the response to the RoleBindingsList request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRoleBindingsList(resp *http.Response) (result RoleBindingsListOperationResponse, err error) { - type page struct { - Values []TrustedAccessRoleBinding `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 RoleBindingsListOperationResponse, err error) { - req, err := c.preparerForRoleBindingsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRoleBindingsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RoleBindingsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// RoleBindingsListComplete retrieves all of the results into a single object -func (c TrustedAccessClient) RoleBindingsListComplete(ctx context.Context, id commonids.KubernetesClusterId) (RoleBindingsListCompleteResult, error) { - return c.RoleBindingsListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleBindingOperationPredicate{}) -} - -// RoleBindingsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TrustedAccessClient) RoleBindingsListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate TrustedAccessRoleBindingOperationPredicate) (resp RoleBindingsListCompleteResult, err error) { - items := make([]TrustedAccessRoleBinding, 0) - - page, err := c.RoleBindingsList(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 := RoleBindingsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist.go new file mode 100644 index 000000000000..124133a7f5e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist.go @@ -0,0 +1,91 @@ +package trustedaccess + +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 RolesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TrustedAccessRole +} + +type RolesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []TrustedAccessRole +} + +// RolesList ... +func (c TrustedAccessClient) RolesList(ctx context.Context, id LocationId) (result RolesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/trustedAccessRoles", 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 *[]TrustedAccessRole `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// RolesListComplete retrieves all the results into a single object +func (c TrustedAccessClient) RolesListComplete(ctx context.Context, id LocationId) (RolesListCompleteResult, error) { + return c.RolesListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleOperationPredicate{}) +} + +// RolesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TrustedAccessClient) RolesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate TrustedAccessRoleOperationPredicate) (result RolesListCompleteResult, err error) { + items := make([]TrustedAccessRole, 0) + + resp, err := c.RolesList(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 = RolesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist_autorest.go deleted file mode 100644 index 5e6dbfb4de99..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview/trustedaccess/method_roleslist_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package trustedaccess - -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 RolesListOperationResponse struct { - HttpResponse *http.Response - Model *[]TrustedAccessRole - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (RolesListOperationResponse, error) -} - -type RolesListCompleteResult struct { - Items []TrustedAccessRole -} - -func (r RolesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r RolesListOperationResponse) LoadMore(ctx context.Context) (resp RolesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// RolesList ... -func (c TrustedAccessClient) RolesList(ctx context.Context, id LocationId) (resp RolesListOperationResponse, err error) { - req, err := c.preparerForRolesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForRolesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForRolesList prepares the RolesList request. -func (c TrustedAccessClient) preparerForRolesList(ctx context.Context, id LocationId) (*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/trustedAccessRoles", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForRolesListWithNextLink prepares the RolesList request with the given nextLink token. -func (c TrustedAccessClient) preparerForRolesListWithNextLink(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)) -} - -// responderForRolesList handles the response to the RolesList request. The method always -// closes the http.Response Body. -func (c TrustedAccessClient) responderForRolesList(resp *http.Response) (result RolesListOperationResponse, err error) { - type page struct { - Values []TrustedAccessRole `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 RolesListOperationResponse, err error) { - req, err := c.preparerForRolesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRolesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "trustedaccess.TrustedAccessClient", "RolesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// RolesListComplete retrieves all of the results into a single object -func (c TrustedAccessClient) RolesListComplete(ctx context.Context, id LocationId) (RolesListCompleteResult, error) { - return c.RolesListCompleteMatchingPredicate(ctx, id, TrustedAccessRoleOperationPredicate{}) -} - -// RolesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TrustedAccessClient) RolesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate TrustedAccessRoleOperationPredicate) (resp RolesListCompleteResult, err error) { - items := make([]TrustedAccessRole, 0) - - page, err := c.RolesList(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 := RolesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/client.go index f4128f5c794c..2edad36c0059 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/client.go @@ -1,18 +1,26 @@ package agentpools -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 AgentPoolsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAgentPoolsClientWithBaseURI(endpoint string) AgentPoolsClient { - return AgentPoolsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAgentPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*AgentPoolsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "agentpools", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AgentPoolsClient: %+v", err) } + + return &AgentPoolsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/constants.go index 875262550864..f4ed24fc4445 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/constants.go @@ -1,6 +1,10 @@ package agentpools -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 PossibleValuesForAgentPoolMode() []string { } } +func (s *AgentPoolMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolMode(input string) (*AgentPoolMode, error) { vals := map[string]AgentPoolMode{ "system": AgentPoolModeSystem, @@ -47,6 +64,19 @@ func PossibleValuesForAgentPoolSSHAccess() []string { } } +func (s *AgentPoolSSHAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolSSHAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolSSHAccess(input string) (*AgentPoolSSHAccess, error) { vals := map[string]AgentPoolSSHAccess{ "disabled": AgentPoolSSHAccessDisabled, @@ -75,6 +105,19 @@ func PossibleValuesForAgentPoolType() []string { } } +func (s *AgentPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolType(input string) (*AgentPoolType, error) { vals := map[string]AgentPoolType{ "availabilityset": AgentPoolTypeAvailabilitySet, @@ -103,6 +146,19 @@ func PossibleValuesForCode() []string { } } +func (s *Code) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCode(input string) (*Code, error) { vals := map[string]Code{ "running": CodeRunning, @@ -137,6 +193,19 @@ func PossibleValuesForGPUInstanceProfile() []string { } } +func (s *GPUInstanceProfile) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGPUInstanceProfile(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGPUInstanceProfile(input string) (*GPUInstanceProfile, error) { vals := map[string]GPUInstanceProfile{ "mig4g": GPUInstanceProfileMIGFourg, @@ -168,6 +237,19 @@ func PossibleValuesForKubeletDiskType() []string { } } +func (s *KubeletDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubeletDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubeletDiskType(input string) (*KubeletDiskType, error) { vals := map[string]KubeletDiskType{ "os": KubeletDiskTypeOS, @@ -196,6 +278,19 @@ func PossibleValuesForOSDiskType() []string { } } +func (s *OSDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSDiskType(input string) (*OSDiskType, error) { vals := map[string]OSDiskType{ "ephemeral": OSDiskTypeEphemeral, @@ -232,6 +327,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "azurelinux": OSSKUAzureLinux, @@ -264,6 +372,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -292,6 +413,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTCP, @@ -320,6 +454,19 @@ func PossibleValuesForScaleDownMode() []string { } } +func (s *ScaleDownMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleDownMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleDownMode(input string) (*ScaleDownMode, error) { vals := map[string]ScaleDownMode{ "deallocate": ScaleDownModeDeallocate, @@ -348,6 +495,19 @@ func PossibleValuesForScaleSetEvictionPolicy() []string { } } +func (s *ScaleSetEvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetEvictionPolicy(input string) (*ScaleSetEvictionPolicy, error) { vals := map[string]ScaleSetEvictionPolicy{ "deallocate": ScaleSetEvictionPolicyDeallocate, @@ -376,6 +536,19 @@ func PossibleValuesForScaleSetPriority() []string { } } +func (s *ScaleSetPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetPriority(input string) (*ScaleSetPriority, error) { vals := map[string]ScaleSetPriority{ "regular": ScaleSetPriorityRegular, @@ -406,6 +579,19 @@ func PossibleValuesForWorkloadRuntime() []string { } } +func (s *WorkloadRuntime) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadRuntime(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWorkloadRuntime(input string) (*WorkloadRuntime, error) { vals := map[string]WorkloadRuntime{ "katamshvvmisolation": WorkloadRuntimeKataMshvVMIsolation, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation.go new file mode 100644 index 000000000000..bb6d06d7487d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation.go @@ -0,0 +1,70 @@ +package agentpools + +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 AbortLatestOperationOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AbortLatestOperation ... +func (c AgentPoolsClient) AbortLatestOperation(ctx context.Context, id AgentPoolId) (result AbortLatestOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/abort", 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 +} + +// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed +func (c AgentPoolsClient) AbortLatestOperationThenPoll(ctx context.Context, id AgentPoolId) error { + result, err := c.AbortLatestOperation(ctx, id) + if err != nil { + return fmt.Errorf("performing AbortLatestOperation: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AbortLatestOperation: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation_autorest.go deleted file mode 100644 index 62c453808c5d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_abortlatestoperation_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package agentpools - -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 AbortLatestOperationOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AbortLatestOperation ... -func (c AgentPoolsClient) AbortLatestOperation(ctx context.Context, id AgentPoolId) (result AbortLatestOperationOperationResponse, err error) { - req, err := c.preparerForAbortLatestOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", nil, "Failure preparing request") - return - } - - result, err = c.senderForAbortLatestOperation(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "AbortLatestOperation", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed -func (c AgentPoolsClient) AbortLatestOperationThenPoll(ctx context.Context, id AgentPoolId) error { - result, err := c.AbortLatestOperation(ctx, id) - if err != nil { - return fmt.Errorf("performing AbortLatestOperation: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AbortLatestOperation: %+v", err) - } - - return nil -} - -// preparerForAbortLatestOperation prepares the AbortLatestOperation request. -func (c AgentPoolsClient) preparerForAbortLatestOperation(ctx context.Context, id AgentPoolId) (*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/abort", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAbortLatestOperation sends the AbortLatestOperation request. The method will close the -// http.Response Body if it receives an error. -func (c AgentPoolsClient) senderForAbortLatestOperation(ctx context.Context, req *http.Request) (future AbortLatestOperationOperationResponse, 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/containerservice/2023-06-02-preview/agentpools/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_createorupdate.go new file mode 100644 index 000000000000..8df06205d3a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_createorupdate.go @@ -0,0 +1,75 @@ +package agentpools + +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 + Model *AgentPool +} + +// CreateOrUpdate ... +func (c AgentPoolsClient) CreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AgentPoolsClient) CreateOrUpdateThenPoll(ctx context.Context, id AgentPoolId, input AgentPool) 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/containerservice/2023-06-02-preview/agentpools/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_createorupdate_autorest.go deleted file mode 100644 index 376fc7fd167f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_createorupdate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package agentpools - -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 - Model *AgentPool -} - -// CreateOrUpdate ... -func (c AgentPoolsClient) CreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c AgentPoolsClient) CreateOrUpdateThenPoll(ctx context.Context, id AgentPoolId, input AgentPool) 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 AgentPoolsClient) preparerForCreateOrUpdate(ctx context.Context, id AgentPoolId, input AgentPool) (*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 AgentPoolsClient) 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/containerservice/2023-06-02-preview/agentpools/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_delete.go new file mode 100644 index 000000000000..d628abea0ea4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_delete.go @@ -0,0 +1,98 @@ +package agentpools + +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 +} + +type DeleteOperationOptions struct { + IgnorePodDisruptionBudget *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IgnorePodDisruptionBudget != nil { + out.Append("ignore-pod-disruption-budget", fmt.Sprintf("%v", *o.IgnorePodDisruptionBudget)) + } + return &out +} + +// Delete ... +func (c AgentPoolsClient) Delete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AgentPoolsClient) DeleteThenPoll(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-06-02-preview/agentpools/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_delete_autorest.go deleted file mode 100644 index 4acc91111ca3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package agentpools - -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 -} - -type DeleteOperationOptions struct { - IgnorePodDisruptionBudget *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IgnorePodDisruptionBudget != nil { - out["ignore-pod-disruption-budget"] = *o.IgnorePodDisruptionBudget - } - - return out -} - -// Delete ... -func (c AgentPoolsClient) Delete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c AgentPoolsClient) DeleteThenPoll(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 AgentPoolsClient) preparerForDelete(ctx context.Context, id AgentPoolId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 AgentPoolsClient) 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/containerservice/2023-06-02-preview/agentpools/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_get.go new file mode 100644 index 000000000000..ad9eccae1761 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_get.go @@ -0,0 +1,51 @@ +package agentpools + +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 *AgentPool +} + +// Get ... +func (c AgentPoolsClient) Get(ctx context.Context, id AgentPoolId) (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/containerservice/2023-06-02-preview/agentpools/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_get_autorest.go deleted file mode 100644 index 989893ea89d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package agentpools - -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 *AgentPool -} - -// Get ... -func (c AgentPoolsClient) Get(ctx context.Context, id AgentPoolId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AgentPoolsClient) preparerForGet(ctx context.Context, id AgentPoolId) (*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 AgentPoolsClient) 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/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions.go new file mode 100644 index 000000000000..2b16f4ecd6aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions.go @@ -0,0 +1,53 @@ +package agentpools + +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 GetAvailableAgentPoolVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPoolAvailableVersions +} + +// GetAvailableAgentPoolVersions ... +func (c AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (result GetAvailableAgentPoolVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/availableAgentPoolVersions", 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/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go deleted file mode 100644 index 73e49c546708..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getavailableagentpoolversions_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package agentpools - -import ( - "context" - "fmt" - "net/http" - - "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 GetAvailableAgentPoolVersionsOperationResponse struct { - HttpResponse *http.Response - Model *AgentPoolAvailableVersions -} - -// GetAvailableAgentPoolVersions ... -func (c AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (result GetAvailableAgentPoolVersionsOperationResponse, err error) { - req, err := c.preparerForGetAvailableAgentPoolVersions(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAvailableAgentPoolVersions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetAvailableAgentPoolVersions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAvailableAgentPoolVersions prepares the GetAvailableAgentPoolVersions request. -func (c AgentPoolsClient) preparerForGetAvailableAgentPoolVersions(ctx context.Context, id commonids.KubernetesClusterId) (*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/availableAgentPoolVersions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAvailableAgentPoolVersions handles the response to the GetAvailableAgentPoolVersions request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForGetAvailableAgentPoolVersions(resp *http.Response) (result GetAvailableAgentPoolVersionsOperationResponse, 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/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile.go new file mode 100644 index 000000000000..518140ec5e80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile.go @@ -0,0 +1,52 @@ +package agentpools + +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 GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AgentPoolUpgradeProfile +} + +// GetUpgradeProfile ... +func (c AgentPoolsClient) GetUpgradeProfile(ctx context.Context, id AgentPoolId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/upgradeProfiles/default", 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/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile_autorest.go deleted file mode 100644 index 0a94e7b1cd75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_getupgradeprofile_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package agentpools - -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 GetUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *AgentPoolUpgradeProfile -} - -// GetUpgradeProfile ... -func (c AgentPoolsClient) GetUpgradeProfile(ctx context.Context, id AgentPoolId) (result GetUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "GetUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetUpgradeProfile prepares the GetUpgradeProfile request. -func (c AgentPoolsClient) preparerForGetUpgradeProfile(ctx context.Context, id AgentPoolId) (*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/upgradeProfiles/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetUpgradeProfile handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (c AgentPoolsClient) responderForGetUpgradeProfile(resp *http.Response) (result GetUpgradeProfileOperationResponse, 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/containerservice/2023-06-02-preview/agentpools/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list.go new file mode 100644 index 000000000000..d4f58e969de4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list.go @@ -0,0 +1,92 @@ +package agentpools + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AgentPool +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AgentPool +} + +// List ... +func (c AgentPoolsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/agentPools", 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 *[]AgentPool `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 AgentPoolsClient) ListComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AgentPoolsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate AgentPoolOperationPredicate) (result ListCompleteResult, err error) { + items := make([]AgentPool, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list_autorest.go deleted file mode 100644 index 85002f4ba417..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package agentpools - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]AgentPool - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []AgentPool -} - -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) -} - -// List ... -func (c AgentPoolsClient) List(ctx context.Context, id commonids.KubernetesClusterId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c AgentPoolsClient) preparerForList(ctx context.Context, id commonids.KubernetesClusterId) (*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/agentPools", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c AgentPoolsClient) 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 AgentPoolsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []AgentPool `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, "agentpools.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c AgentPoolsClient) ListComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, AgentPoolOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AgentPoolsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate AgentPoolOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]AgentPool, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion.go new file mode 100644 index 000000000000..fa6b0240a55f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion.go @@ -0,0 +1,71 @@ +package agentpools + +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 UpgradeNodeImageVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AgentPool +} + +// UpgradeNodeImageVersion ... +func (c AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (result UpgradeNodeImageVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeNodeImageVersion", 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 +} + +// UpgradeNodeImageVersionThenPoll performs UpgradeNodeImageVersion then polls until it's completed +func (c AgentPoolsClient) UpgradeNodeImageVersionThenPoll(ctx context.Context, id AgentPoolId) error { + result, err := c.UpgradeNodeImageVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing UpgradeNodeImageVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpgradeNodeImageVersion: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion_autorest.go deleted file mode 100644 index 8f804652e0fa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/agentpools/method_upgradenodeimageversion_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package agentpools - -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 UpgradeNodeImageVersionOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *AgentPool -} - -// UpgradeNodeImageVersion ... -func (c AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (result UpgradeNodeImageVersionOperationResponse, err error) { - req, err := c.preparerForUpgradeNodeImageVersion(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "UpgradeNodeImageVersion", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpgradeNodeImageVersion(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "agentpools.AgentPoolsClient", "UpgradeNodeImageVersion", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpgradeNodeImageVersionThenPoll performs UpgradeNodeImageVersion then polls until it's completed -func (c AgentPoolsClient) UpgradeNodeImageVersionThenPoll(ctx context.Context, id AgentPoolId) error { - result, err := c.UpgradeNodeImageVersion(ctx, id) - if err != nil { - return fmt.Errorf("performing UpgradeNodeImageVersion: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after UpgradeNodeImageVersion: %+v", err) - } - - return nil -} - -// preparerForUpgradeNodeImageVersion prepares the UpgradeNodeImageVersion request. -func (c AgentPoolsClient) preparerForUpgradeNodeImageVersion(ctx context.Context, id AgentPoolId) (*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/upgradeNodeImageVersion", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpgradeNodeImageVersion sends the UpgradeNodeImageVersion request. The method will close the -// http.Response Body if it receives an error. -func (c AgentPoolsClient) senderForUpgradeNodeImageVersion(ctx context.Context, req *http.Request) (future UpgradeNodeImageVersionOperationResponse, 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/containerservice/2023-06-02-preview/maintenanceconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/client.go index c955dc01ae80..4d799de617cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/client.go @@ -1,18 +1,26 @@ package maintenanceconfigurations -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 MaintenanceConfigurationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewMaintenanceConfigurationsClientWithBaseURI(endpoint string) MaintenanceConfigurationsClient { - return MaintenanceConfigurationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewMaintenanceConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*MaintenanceConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "maintenanceconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MaintenanceConfigurationsClient: %+v", err) } + + return &MaintenanceConfigurationsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/constants.go index 7bac817aae7d..2fdd49e9763c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/constants.go @@ -1,6 +1,10 @@ package maintenanceconfigurations -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. @@ -25,6 +29,19 @@ func PossibleValuesForType() []string { } } +func (s *Type) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseType(input string) (*Type, error) { vals := map[string]Type{ "first": TypeFirst, @@ -66,6 +83,19 @@ func PossibleValuesForWeekDay() []string { } } +func (s *WeekDay) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWeekDay(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWeekDay(input string) (*WeekDay, error) { vals := map[string]WeekDay{ "friday": WeekDayFriday, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate.go new file mode 100644 index 000000000000..b4ca498cb3a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate.go @@ -0,0 +1,56 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// CreateOrUpdate ... +func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go deleted file mode 100644 index d3ce306fb63f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// CreateOrUpdate ... -func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c MaintenanceConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*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 MaintenanceConfigurationsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete.go new file mode 100644 index 000000000000..5993be4c15a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete.go @@ -0,0 +1,47 @@ +package maintenanceconfigurations + +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 MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (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/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete_autorest.go deleted file mode 100644 index 27bc6b8c8559..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package maintenanceconfigurations - -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 MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c MaintenanceConfigurationsClient) preparerForDelete(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get.go new file mode 100644 index 000000000000..9a6e4324c68e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get.go @@ -0,0 +1,51 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// Get ... +func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (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/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get_autorest.go deleted file mode 100644 index 57a6eb55e01d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// Get ... -func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c MaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go new file mode 100644 index 000000000000..dae38e858212 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster.go @@ -0,0 +1,92 @@ +package maintenanceconfigurations + +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 ListByManagedClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]MaintenanceConfiguration +} + +type ListByManagedClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []MaintenanceConfiguration +} + +// ListByManagedCluster ... +func (c MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (result ListByManagedClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/maintenanceConfigurations", 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 *[]MaintenanceConfiguration `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByManagedClusterComplete retrieves all the results into a single object +func (c MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListByManagedClusterCompleteResult, error) { + return c.ListByManagedClusterCompleteMatchingPredicate(ctx, id, MaintenanceConfigurationOperationPredicate{}) +} + +// ListByManagedClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MaintenanceConfigurationsClient) ListByManagedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MaintenanceConfigurationOperationPredicate) (result ListByManagedClusterCompleteResult, err error) { + items := make([]MaintenanceConfiguration, 0) + + resp, err := c.ListByManagedCluster(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 = ListByManagedClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go deleted file mode 100644 index 7463165baacd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations/method_listbymanagedcluster_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package maintenanceconfigurations - -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 ListByManagedClusterOperationResponse struct { - HttpResponse *http.Response - Model *[]MaintenanceConfiguration - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByManagedClusterOperationResponse, error) -} - -type ListByManagedClusterCompleteResult struct { - Items []MaintenanceConfiguration -} - -func (r ListByManagedClusterOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByManagedClusterOperationResponse) LoadMore(ctx context.Context) (resp ListByManagedClusterOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByManagedCluster ... -func (c MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (resp ListByManagedClusterOperationResponse, err error) { - req, err := c.preparerForListByManagedCluster(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByManagedCluster(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByManagedCluster prepares the ListByManagedCluster request. -func (c MaintenanceConfigurationsClient) preparerForListByManagedCluster(ctx context.Context, id commonids.KubernetesClusterId) (*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/maintenanceConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByManagedClusterWithNextLink prepares the ListByManagedCluster request with the given nextLink token. -func (c MaintenanceConfigurationsClient) preparerForListByManagedClusterWithNextLink(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)) -} - -// responderForListByManagedCluster handles the response to the ListByManagedCluster request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForListByManagedCluster(resp *http.Response) (result ListByManagedClusterOperationResponse, err error) { - type page struct { - Values []MaintenanceConfiguration `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 ListByManagedClusterOperationResponse, err error) { - req, err := c.preparerForListByManagedClusterWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByManagedCluster(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ListByManagedCluster", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByManagedClusterComplete retrieves all of the results into a single object -func (c MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListByManagedClusterCompleteResult, error) { - return c.ListByManagedClusterCompleteMatchingPredicate(ctx, id, MaintenanceConfigurationOperationPredicate{}) -} - -// ListByManagedClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MaintenanceConfigurationsClient) ListByManagedClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MaintenanceConfigurationOperationPredicate) (resp ListByManagedClusterCompleteResult, err error) { - items := make([]MaintenanceConfiguration, 0) - - page, err := c.ListByManagedCluster(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 := ListByManagedClusterCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/client.go index df94ecc4199e..5081c63c8e61 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/client.go @@ -1,18 +1,26 @@ package managedclusters -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 ManagedClustersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedClustersClientWithBaseURI(endpoint string) ManagedClustersClient { - return ManagedClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedClustersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedClustersClient: %+v", err) } + + return &ManagedClustersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/constants.go index 69eaf648c0fe..38ea88f7e8e4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/constants.go @@ -1,6 +1,10 @@ package managedclusters -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 PossibleValuesForAgentPoolMode() []string { } } +func (s *AgentPoolMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolMode(input string) (*AgentPoolMode, error) { vals := map[string]AgentPoolMode{ "system": AgentPoolModeSystem, @@ -47,6 +64,19 @@ func PossibleValuesForAgentPoolSSHAccess() []string { } } +func (s *AgentPoolSSHAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolSSHAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolSSHAccess(input string) (*AgentPoolSSHAccess, error) { vals := map[string]AgentPoolSSHAccess{ "disabled": AgentPoolSSHAccessDisabled, @@ -75,6 +105,19 @@ func PossibleValuesForAgentPoolType() []string { } } +func (s *AgentPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAgentPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAgentPoolType(input string) (*AgentPoolType, error) { vals := map[string]AgentPoolType{ "availabilityset": AgentPoolTypeAvailabilitySet, @@ -103,6 +146,19 @@ func PossibleValuesForBackendPoolType() []string { } } +func (s *BackendPoolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendPoolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBackendPoolType(input string) (*BackendPoolType, error) { vals := map[string]BackendPoolType{ "nodeip": BackendPoolTypeNodeIP, @@ -131,6 +187,19 @@ func PossibleValuesForCode() []string { } } +func (s *Code) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCode(input string) (*Code, error) { vals := map[string]Code{ "running": CodeRunning, @@ -157,6 +226,19 @@ func PossibleValuesForControlPlaneUpgradeOverride() []string { } } +func (s *ControlPlaneUpgradeOverride) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseControlPlaneUpgradeOverride(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseControlPlaneUpgradeOverride(input string) (*ControlPlaneUpgradeOverride, error) { vals := map[string]ControlPlaneUpgradeOverride{ "ignorekubernetesdeprecations": ControlPlaneUpgradeOverrideIgnoreKubernetesDeprecations, @@ -184,6 +266,19 @@ func PossibleValuesForControlledValues() []string { } } +func (s *ControlledValues) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseControlledValues(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseControlledValues(input string) (*ControlledValues, error) { vals := map[string]ControlledValues{ "requestsandlimits": ControlledValuesRequestsAndLimits, @@ -216,6 +311,19 @@ func PossibleValuesForExpander() []string { } } +func (s *Expander) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpander(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseExpander(input string) (*Expander, error) { vals := map[string]Expander{ "least-waste": ExpanderLeastNegativewaste, @@ -246,6 +354,19 @@ func PossibleValuesForFormat() []string { } } +func (s *Format) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFormat(input string) (*Format, error) { vals := map[string]Format{ "azure": FormatAzure, @@ -280,6 +401,19 @@ func PossibleValuesForGPUInstanceProfile() []string { } } +func (s *GPUInstanceProfile) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGPUInstanceProfile(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGPUInstanceProfile(input string) (*GPUInstanceProfile, error) { vals := map[string]GPUInstanceProfile{ "mig4g": GPUInstanceProfileMIGFourg, @@ -311,6 +445,19 @@ func PossibleValuesForIPFamily() []string { } } +func (s *IPFamily) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPFamily(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIPFamily(input string) (*IPFamily, error) { vals := map[string]IPFamily{ "ipv4": IPFamilyIPvFour, @@ -339,6 +486,19 @@ func PossibleValuesForIPvsScheduler() []string { } } +func (s *IPvsScheduler) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPvsScheduler(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIPvsScheduler(input string) (*IPvsScheduler, error) { vals := map[string]IPvsScheduler{ "leastconnection": IPvsSchedulerLeastConnection, @@ -367,6 +527,19 @@ func PossibleValuesForIstioIngressGatewayMode() []string { } } +func (s *IstioIngressGatewayMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIstioIngressGatewayMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIstioIngressGatewayMode(input string) (*IstioIngressGatewayMode, error) { vals := map[string]IstioIngressGatewayMode{ "external": IstioIngressGatewayModeExternal, @@ -395,6 +568,19 @@ func PossibleValuesForKeyVaultNetworkAccessTypes() []string { } } +func (s *KeyVaultNetworkAccessTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyVaultNetworkAccessTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyVaultNetworkAccessTypes(input string) (*KeyVaultNetworkAccessTypes, error) { vals := map[string]KeyVaultNetworkAccessTypes{ "private": KeyVaultNetworkAccessTypesPrivate, @@ -423,6 +609,19 @@ func PossibleValuesForKubeletDiskType() []string { } } +func (s *KubeletDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubeletDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubeletDiskType(input string) (*KubeletDiskType, error) { vals := map[string]KubeletDiskType{ "os": KubeletDiskTypeOS, @@ -451,6 +650,19 @@ func PossibleValuesForKubernetesSupportPlan() []string { } } +func (s *KubernetesSupportPlan) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKubernetesSupportPlan(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKubernetesSupportPlan(input string) (*KubernetesSupportPlan, error) { vals := map[string]KubernetesSupportPlan{ "akslongtermsupport": KubernetesSupportPlanAKSLongTermSupport, @@ -481,6 +693,19 @@ func PossibleValuesForLevel() []string { } } +func (s *Level) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLevel(input string) (*Level, error) { vals := map[string]Level{ "enforcement": LevelEnforcement, @@ -510,6 +735,19 @@ func PossibleValuesForLicenseType() []string { } } +func (s *LicenseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLicenseType(input string) (*LicenseType, error) { vals := map[string]LicenseType{ "none": LicenseTypeNone, @@ -538,6 +776,19 @@ func PossibleValuesForLoadBalancerSku() []string { } } +func (s *LoadBalancerSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoadBalancerSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoadBalancerSku(input string) (*LoadBalancerSku, error) { vals := map[string]LoadBalancerSku{ "basic": LoadBalancerSkuBasic, @@ -574,6 +825,19 @@ func PossibleValuesForManagedClusterPodIdentityProvisioningState() []string { } } +func (s *ManagedClusterPodIdentityProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterPodIdentityProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterPodIdentityProvisioningState(input string) (*ManagedClusterPodIdentityProvisioningState, error) { vals := map[string]ManagedClusterPodIdentityProvisioningState{ "assigned": ManagedClusterPodIdentityProvisioningStateAssigned, @@ -604,6 +868,19 @@ func PossibleValuesForManagedClusterSKUName() []string { } } +func (s *ManagedClusterSKUName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUName(input string) (*ManagedClusterSKUName, error) { vals := map[string]ManagedClusterSKUName{ "base": ManagedClusterSKUNameBase, @@ -633,6 +910,19 @@ func PossibleValuesForManagedClusterSKUTier() []string { } } +func (s *ManagedClusterSKUTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterSKUTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterSKUTier(input string) (*ManagedClusterSKUTier, error) { vals := map[string]ManagedClusterSKUTier{ "free": ManagedClusterSKUTierFree, @@ -662,6 +952,19 @@ func PossibleValuesForMode() []string { } } +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMode(input string) (*Mode, error) { vals := map[string]Mode{ "iptables": ModeIPTABLES, @@ -690,6 +993,19 @@ func PossibleValuesForNetworkDataplane() []string { } } +func (s *NetworkDataplane) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkDataplane(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkDataplane(input string) (*NetworkDataplane, error) { vals := map[string]NetworkDataplane{ "azure": NetworkDataplaneAzure, @@ -718,6 +1034,19 @@ func PossibleValuesForNetworkMode() []string { } } +func (s *NetworkMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkMode(input string) (*NetworkMode, error) { vals := map[string]NetworkMode{ "bridge": NetworkModeBridge, @@ -748,6 +1077,19 @@ func PossibleValuesForNetworkPlugin() []string { } } +func (s *NetworkPlugin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPlugin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPlugin(input string) (*NetworkPlugin, error) { vals := map[string]NetworkPlugin{ "azure": NetworkPluginAzure, @@ -775,6 +1117,19 @@ func PossibleValuesForNetworkPluginMode() []string { } } +func (s *NetworkPluginMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPluginMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPluginMode(input string) (*NetworkPluginMode, error) { vals := map[string]NetworkPluginMode{ "overlay": NetworkPluginModeOverlay, @@ -804,6 +1159,19 @@ func PossibleValuesForNetworkPolicy() []string { } } +func (s *NetworkPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNetworkPolicy(input string) (*NetworkPolicy, error) { vals := map[string]NetworkPolicy{ "azure": NetworkPolicyAzure, @@ -837,6 +1205,19 @@ func PossibleValuesForNodeOSUpgradeChannel() []string { } } +func (s *NodeOSUpgradeChannel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNodeOSUpgradeChannel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNodeOSUpgradeChannel(input string) (*NodeOSUpgradeChannel, error) { vals := map[string]NodeOSUpgradeChannel{ "nodeimage": NodeOSUpgradeChannelNodeImage, @@ -867,6 +1248,19 @@ func PossibleValuesForOSDiskType() []string { } } +func (s *OSDiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSDiskType(input string) (*OSDiskType, error) { vals := map[string]OSDiskType{ "ephemeral": OSDiskTypeEphemeral, @@ -903,6 +1297,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "azurelinux": OSSKUAzureLinux, @@ -935,6 +1342,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -967,6 +1387,19 @@ func PossibleValuesForOutboundType() []string { } } +func (s *OutboundType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOutboundType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOutboundType(input string) (*OutboundType, error) { vals := map[string]OutboundType{ "loadbalancer": OutboundTypeLoadBalancer, @@ -997,6 +1430,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTCP, @@ -1027,6 +1473,19 @@ func PossibleValuesForPublicNetworkAccess() []string { } } +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { vals := map[string]PublicNetworkAccess{ "disabled": PublicNetworkAccessDisabled, @@ -1056,6 +1515,19 @@ func PossibleValuesForRestrictionLevel() []string { } } +func (s *RestrictionLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestrictionLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseRestrictionLevel(input string) (*RestrictionLevel, error) { vals := map[string]RestrictionLevel{ "readonly": RestrictionLevelReadOnly, @@ -1084,6 +1556,19 @@ func PossibleValuesForScaleDownMode() []string { } } +func (s *ScaleDownMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleDownMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleDownMode(input string) (*ScaleDownMode, error) { vals := map[string]ScaleDownMode{ "deallocate": ScaleDownModeDeallocate, @@ -1112,6 +1597,19 @@ func PossibleValuesForScaleSetEvictionPolicy() []string { } } +func (s *ScaleSetEvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetEvictionPolicy(input string) (*ScaleSetEvictionPolicy, error) { vals := map[string]ScaleSetEvictionPolicy{ "deallocate": ScaleSetEvictionPolicyDeallocate, @@ -1140,6 +1638,19 @@ func PossibleValuesForScaleSetPriority() []string { } } +func (s *ScaleSetPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScaleSetPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScaleSetPriority(input string) (*ScaleSetPriority, error) { vals := map[string]ScaleSetPriority{ "regular": ScaleSetPriorityRegular, @@ -1168,6 +1679,19 @@ func PossibleValuesForServiceMeshMode() []string { } } +func (s *ServiceMeshMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServiceMeshMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseServiceMeshMode(input string) (*ServiceMeshMode, error) { vals := map[string]ServiceMeshMode{ "disabled": ServiceMeshModeDisabled, @@ -1200,6 +1724,19 @@ func PossibleValuesForUpdateMode() []string { } } +func (s *UpdateMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpdateMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpdateMode(input string) (*UpdateMode, error) { vals := map[string]UpdateMode{ "auto": UpdateModeAuto, @@ -1236,6 +1773,19 @@ func PossibleValuesForUpgradeChannel() []string { } } +func (s *UpgradeChannel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeChannel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpgradeChannel(input string) (*UpgradeChannel, error) { vals := map[string]UpgradeChannel{ "node-image": UpgradeChannelNodeNegativeimage, @@ -1269,6 +1819,19 @@ func PossibleValuesForWorkloadRuntime() []string { } } +func (s *WorkloadRuntime) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadRuntime(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseWorkloadRuntime(input string) (*WorkloadRuntime, error) { vals := map[string]WorkloadRuntime{ "katamshvvmisolation": WorkloadRuntimeKataMshvVMIsolation, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation.go new file mode 100644 index 000000000000..a37480f49c96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 AbortLatestOperationOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AbortLatestOperation ... +func (c ManagedClustersClient) AbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (result AbortLatestOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/abort", 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 +} + +// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed +func (c ManagedClustersClient) AbortLatestOperationThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.AbortLatestOperation(ctx, id) + if err != nil { + return fmt.Errorf("performing AbortLatestOperation: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AbortLatestOperation: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation_autorest.go deleted file mode 100644 index 76ae937e4883..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_abortlatestoperation_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 AbortLatestOperationOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AbortLatestOperation ... -func (c ManagedClustersClient) AbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (result AbortLatestOperationOperationResponse, err error) { - req, err := c.preparerForAbortLatestOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", nil, "Failure preparing request") - return - } - - result, err = c.senderForAbortLatestOperation(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "AbortLatestOperation", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AbortLatestOperationThenPoll performs AbortLatestOperation then polls until it's completed -func (c ManagedClustersClient) AbortLatestOperationThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.AbortLatestOperation(ctx, id) - if err != nil { - return fmt.Errorf("performing AbortLatestOperation: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AbortLatestOperation: %+v", err) - } - - return nil -} - -// preparerForAbortLatestOperation prepares the AbortLatestOperation request. -func (c ManagedClustersClient) preparerForAbortLatestOperation(ctx context.Context, id commonids.KubernetesClusterId) (*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/abort", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAbortLatestOperation sends the AbortLatestOperation request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForAbortLatestOperation(ctx context.Context, req *http.Request) (future AbortLatestOperationOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_createorupdate.go new file mode 100644 index 000000000000..c32d75d0be9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_createorupdate.go @@ -0,0 +1,76 @@ +package managedclusters + +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/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 + Model *ManagedCluster +} + +// CreateOrUpdate ... +func (c ManagedClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) 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/containerservice/2023-06-02-preview/managedclusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_createorupdate_autorest.go deleted file mode 100644 index 3a39a0803554..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_createorupdate_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *ManagedCluster -} - -// CreateOrUpdate ... -func (c ManagedClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ManagedClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) 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 ManagedClustersClient) preparerForCreateOrUpdate(ctx context.Context, id commonids.KubernetesClusterId, input ManagedCluster) (*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 ManagedClustersClient) 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/containerservice/2023-06-02-preview/managedclusters/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_delete.go new file mode 100644 index 000000000000..53bf6a9ac7c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_delete.go @@ -0,0 +1,99 @@ +package managedclusters + +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/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 +} + +type DeleteOperationOptions struct { + IgnorePodDisruptionBudget *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IgnorePodDisruptionBudget != nil { + out.Append("ignore-pod-disruption-budget", fmt.Sprintf("%v", *o.IgnorePodDisruptionBudget)) + } + return &out +} + +// Delete ... +func (c ManagedClustersClient) Delete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-06-02-preview/managedclusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_delete_autorest.go deleted file mode 100644 index b6a15e70f3bd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_delete_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package managedclusters - -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" - "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 DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IgnorePodDisruptionBudget *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IgnorePodDisruptionBudget != nil { - out["ignore-pod-disruption-budget"] = *o.IgnorePodDisruptionBudget - } - - return out -} - -// Delete ... -func (c ManagedClustersClient) Delete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ManagedClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 ManagedClustersClient) preparerForDelete(ctx context.Context, id commonids.KubernetesClusterId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 ManagedClustersClient) 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/containerservice/2023-06-02-preview/managedclusters/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_get.go new file mode 100644 index 000000000000..fe45d85e520e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_get.go @@ -0,0 +1,52 @@ +package managedclusters + +import ( + "context" + "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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// Get ... +func (c ManagedClustersClient) Get(ctx context.Context, id commonids.KubernetesClusterId) (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/containerservice/2023-06-02-preview/managedclusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_get_autorest.go deleted file mode 100644 index dd792998fed2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -import ( - "context" - "net/http" - - "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 GetOperationResponse struct { - HttpResponse *http.Response - Model *ManagedCluster -} - -// Get ... -func (c ManagedClustersClient) Get(ctx context.Context, id commonids.KubernetesClusterId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClustersClient) preparerForGet(ctx context.Context, id commonids.KubernetesClusterId) (*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 ManagedClustersClient) 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/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile.go new file mode 100644 index 000000000000..3aef3b2c7135 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile.go @@ -0,0 +1,52 @@ +package managedclusters + +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 GetAccessProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterAccessProfile +} + +// GetAccessProfile ... +func (c ManagedClustersClient) GetAccessProfile(ctx context.Context, id AccessProfileId) (result GetAccessProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listCredential", 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/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile_autorest.go deleted file mode 100644 index 82b7df70d16e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getaccessprofile_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -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 GetAccessProfileOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterAccessProfile -} - -// GetAccessProfile ... -func (c ManagedClustersClient) GetAccessProfile(ctx context.Context, id AccessProfileId) (result GetAccessProfileOperationResponse, err error) { - req, err := c.preparerForGetAccessProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAccessProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetAccessProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAccessProfile prepares the GetAccessProfile request. -func (c ManagedClustersClient) preparerForGetAccessProfile(ctx context.Context, id AccessProfileId) (*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/listCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAccessProfile handles the response to the GetAccessProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetAccessProfile(resp *http.Response) (result GetAccessProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult.go new file mode 100644 index 000000000000..f1bd0c65255d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult.go @@ -0,0 +1,52 @@ +package managedclusters + +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 GetCommandResultOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// GetCommandResult ... +func (c ManagedClustersClient) GetCommandResult(ctx context.Context, id CommandResultId) (result GetCommandResultOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult_autorest.go deleted file mode 100644 index b5d9f095c1eb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getcommandresult_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclusters - -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 GetCommandResultOperationResponse struct { - HttpResponse *http.Response - Model *RunCommandResult -} - -// GetCommandResult ... -func (c ManagedClustersClient) GetCommandResult(ctx context.Context, id CommandResultId) (result GetCommandResultOperationResponse, err error) { - req, err := c.preparerForGetCommandResult(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetCommandResult(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetCommandResult", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetCommandResult prepares the GetCommandResult request. -func (c ManagedClustersClient) preparerForGetCommandResult(ctx context.Context, id CommandResultId) (*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)) -} - -// responderForGetCommandResult handles the response to the GetCommandResult request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetCommandResult(resp *http.Response) (result GetCommandResultOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile.go new file mode 100644 index 000000000000..465f2a76773c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile.go @@ -0,0 +1,51 @@ +package managedclusters + +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 GetMeshRevisionProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MeshRevisionProfile +} + +// GetMeshRevisionProfile ... +func (c ManagedClustersClient) GetMeshRevisionProfile(ctx context.Context, id MeshRevisionProfileId) (result GetMeshRevisionProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile_autorest.go deleted file mode 100644 index e21e72bd82e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshrevisionprofile_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclusters - -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 GetMeshRevisionProfileOperationResponse struct { - HttpResponse *http.Response - Model *MeshRevisionProfile -} - -// GetMeshRevisionProfile ... -func (c ManagedClustersClient) GetMeshRevisionProfile(ctx context.Context, id MeshRevisionProfileId) (result GetMeshRevisionProfileOperationResponse, err error) { - req, err := c.preparerForGetMeshRevisionProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetMeshRevisionProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetMeshRevisionProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetMeshRevisionProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetMeshRevisionProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetMeshRevisionProfile prepares the GetMeshRevisionProfile request. -func (c ManagedClustersClient) preparerForGetMeshRevisionProfile(ctx context.Context, id MeshRevisionProfileId) (*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)) -} - -// responderForGetMeshRevisionProfile handles the response to the GetMeshRevisionProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetMeshRevisionProfile(resp *http.Response) (result GetMeshRevisionProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile.go new file mode 100644 index 000000000000..dbe93c80dd79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile.go @@ -0,0 +1,51 @@ +package managedclusters + +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 GetMeshUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MeshUpgradeProfile +} + +// GetMeshUpgradeProfile ... +func (c ManagedClustersClient) GetMeshUpgradeProfile(ctx context.Context, id MeshUpgradeProfileId) (result GetMeshUpgradeProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile_autorest.go deleted file mode 100644 index 2bfd8e365ddf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getmeshupgradeprofile_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedclusters - -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 GetMeshUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *MeshUpgradeProfile -} - -// GetMeshUpgradeProfile ... -func (c ManagedClustersClient) GetMeshUpgradeProfile(ctx context.Context, id MeshUpgradeProfileId) (result GetMeshUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetMeshUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetMeshUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetMeshUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetMeshUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetMeshUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetMeshUpgradeProfile prepares the GetMeshUpgradeProfile request. -func (c ManagedClustersClient) preparerForGetMeshUpgradeProfile(ctx context.Context, id MeshUpgradeProfileId) (*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)) -} - -// responderForGetMeshUpgradeProfile handles the response to the GetMeshUpgradeProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetMeshUpgradeProfile(resp *http.Response) (result GetMeshUpgradeProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_getosoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getosoptions.go new file mode 100644 index 000000000000..88fd5581bc89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getosoptions.go @@ -0,0 +1,80 @@ +package managedclusters + +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 GetOSOptionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OSOptionProfile +} + +type GetOSOptionsOperationOptions struct { + ResourceType *string +} + +func DefaultGetOSOptionsOperationOptions() GetOSOptionsOperationOptions { + return GetOSOptionsOperationOptions{} +} + +func (o GetOSOptionsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOSOptionsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOSOptionsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ResourceType != nil { + out.Append("resource-type", fmt.Sprintf("%v", *o.ResourceType)) + } + return &out +} + +// GetOSOptions ... +func (c ManagedClustersClient) GetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (result GetOSOptionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/osOptions/default", 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/containerservice/2023-06-02-preview/managedclusters/method_getosoptions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getosoptions_autorest.go deleted file mode 100644 index 59f01e6d53f8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getosoptions_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package managedclusters - -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 GetOSOptionsOperationResponse struct { - HttpResponse *http.Response - Model *OSOptionProfile -} - -type GetOSOptionsOperationOptions struct { - ResourceType *string -} - -func DefaultGetOSOptionsOperationOptions() GetOSOptionsOperationOptions { - return GetOSOptionsOperationOptions{} -} - -func (o GetOSOptionsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOSOptionsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ResourceType != nil { - out["resource-type"] = *o.ResourceType - } - - return out -} - -// GetOSOptions ... -func (c ManagedClustersClient) GetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (result GetOSOptionsOperationResponse, err error) { - req, err := c.preparerForGetOSOptions(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetOSOptions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetOSOptions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetOSOptions prepares the GetOSOptions request. -func (c ManagedClustersClient) preparerForGetOSOptions(ctx context.Context, id LocationId, options GetOSOptionsOperationOptions) (*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/osOptions/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetOSOptions handles the response to the GetOSOptions request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetOSOptions(resp *http.Response) (result GetOSOptionsOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile.go new file mode 100644 index 000000000000..52c89ae8d473 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile.go @@ -0,0 +1,53 @@ +package managedclusters + +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 GetUpgradeProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedClusterUpgradeProfile +} + +// GetUpgradeProfile ... +func (c ManagedClustersClient) GetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (result GetUpgradeProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/upgradeProfiles/default", 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/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile_autorest.go deleted file mode 100644 index cd10c7215b92..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_getupgradeprofile_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 GetUpgradeProfileOperationResponse struct { - HttpResponse *http.Response - Model *ManagedClusterUpgradeProfile -} - -// GetUpgradeProfile ... -func (c ManagedClustersClient) GetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (result GetUpgradeProfileOperationResponse, err error) { - req, err := c.preparerForGetUpgradeProfile(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetUpgradeProfile(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "GetUpgradeProfile", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetUpgradeProfile prepares the GetUpgradeProfile request. -func (c ManagedClustersClient) preparerForGetUpgradeProfile(ctx context.Context, id commonids.KubernetesClusterId) (*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/upgradeProfiles/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetUpgradeProfile handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForGetUpgradeProfile(resp *http.Response) (result GetUpgradeProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list.go new file mode 100644 index 000000000000..17fb5e8fb680 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ManagedCluster +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// List ... +func (c ManagedClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/managedClusters", 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 *[]ManagedCluster `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 ManagedClustersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list_autorest.go deleted file mode 100644 index 871409d1963c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ManagedCluster -} - -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) -} - -// List ... -func (c ManagedClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ManagedClustersClient) preparerForList(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.ContainerService/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ManagedClustersClient) 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 ManagedClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedclusters.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ManagedCluster, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup.go new file mode 100644 index 000000000000..ee4658b5e0f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedclusters + +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 *[]ManagedCluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// ListByResourceGroup ... +func (c ManagedClustersClient) 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.ContainerService/managedClusters", 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 *[]ManagedCluster `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 ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedCluster, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup_autorest.go deleted file mode 100644 index bc961d43758e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedCluster -} - -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 ManagedClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClustersClient) 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.ContainerService/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClustersClient) 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 ManagedClustersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedclusters.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedCluster, 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/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials.go new file mode 100644 index 000000000000..1327fd22ff5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials.go @@ -0,0 +1,81 @@ +package managedclusters + +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 ListClusterAdminCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterAdminCredentialsOperationOptions struct { + ServerFqdn *string +} + +func DefaultListClusterAdminCredentialsOperationOptions() ListClusterAdminCredentialsOperationOptions { + return ListClusterAdminCredentialsOperationOptions{} +} + +func (o ListClusterAdminCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterAdminCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterAdminCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterAdminCredentials ... +func (c ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (result ListClusterAdminCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterAdminCredential", 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/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go deleted file mode 100644 index f8024c5b3075..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusteradmincredentials_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterAdminCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterAdminCredentialsOperationOptions struct { - ServerFqdn *string -} - -func DefaultListClusterAdminCredentialsOperationOptions() ListClusterAdminCredentialsOperationOptions { - return ListClusterAdminCredentialsOperationOptions{} -} - -func (o ListClusterAdminCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterAdminCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterAdminCredentials ... -func (c ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (result ListClusterAdminCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterAdminCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterAdminCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterAdminCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterAdminCredentials prepares the ListClusterAdminCredentials request. -func (c ManagedClustersClient) preparerForListClusterAdminCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterAdminCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterAdminCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterAdminCredentials handles the response to the ListClusterAdminCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterAdminCredentials(resp *http.Response) (result ListClusterAdminCredentialsOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials.go new file mode 100644 index 000000000000..06110ff0a0f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials.go @@ -0,0 +1,81 @@ +package managedclusters + +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 ListClusterMonitoringUserCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterMonitoringUserCredentialsOperationOptions struct { + ServerFqdn *string +} + +func DefaultListClusterMonitoringUserCredentialsOperationOptions() ListClusterMonitoringUserCredentialsOperationOptions { + return ListClusterMonitoringUserCredentialsOperationOptions{} +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterMonitoringUserCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterMonitoringUserCredentials ... +func (c ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (result ListClusterMonitoringUserCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listClusterMonitoringUserCredential", 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/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go deleted file mode 100644 index a7f62d3aff19..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclustermonitoringusercredentials_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterMonitoringUserCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterMonitoringUserCredentialsOperationOptions struct { - ServerFqdn *string -} - -func DefaultListClusterMonitoringUserCredentialsOperationOptions() ListClusterMonitoringUserCredentialsOperationOptions { - return ListClusterMonitoringUserCredentialsOperationOptions{} -} - -func (o ListClusterMonitoringUserCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterMonitoringUserCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterMonitoringUserCredentials ... -func (c ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (result ListClusterMonitoringUserCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterMonitoringUserCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterMonitoringUserCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterMonitoringUserCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterMonitoringUserCredentials prepares the ListClusterMonitoringUserCredentials request. -func (c ManagedClustersClient) preparerForListClusterMonitoringUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterMonitoringUserCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterMonitoringUserCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterMonitoringUserCredentials handles the response to the ListClusterMonitoringUserCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterMonitoringUserCredentials(resp *http.Response) (result ListClusterMonitoringUserCredentialsOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials.go new file mode 100644 index 000000000000..e12b97e5b93f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials.go @@ -0,0 +1,85 @@ +package managedclusters + +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 ListClusterUserCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CredentialResults +} + +type ListClusterUserCredentialsOperationOptions struct { + Format *Format + ServerFqdn *string +} + +func DefaultListClusterUserCredentialsOperationOptions() ListClusterUserCredentialsOperationOptions { + return ListClusterUserCredentialsOperationOptions{} +} + +func (o ListClusterUserCredentialsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListClusterUserCredentialsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListClusterUserCredentialsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + if o.ServerFqdn != nil { + out.Append("server-fqdn", fmt.Sprintf("%v", *o.ServerFqdn)) + } + return &out +} + +// ListClusterUserCredentials ... +func (c ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (result ListClusterUserCredentialsOperationResponse, 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()), + 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/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials_autorest.go deleted file mode 100644 index 0c90a5488c66..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listclusterusercredentials_autorest.go +++ /dev/null @@ -1,104 +0,0 @@ -package managedclusters - -import ( - "context" - "fmt" - "net/http" - - "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 ListClusterUserCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *CredentialResults -} - -type ListClusterUserCredentialsOperationOptions struct { - Format *Format - ServerFqdn *string -} - -func DefaultListClusterUserCredentialsOperationOptions() ListClusterUserCredentialsOperationOptions { - return ListClusterUserCredentialsOperationOptions{} -} - -func (o ListClusterUserCredentialsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListClusterUserCredentialsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - if o.ServerFqdn != nil { - out["server-fqdn"] = *o.ServerFqdn - } - - return out -} - -// ListClusterUserCredentials ... -func (c ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (result ListClusterUserCredentialsOperationResponse, err error) { - req, err := c.preparerForListClusterUserCredentials(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListClusterUserCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListClusterUserCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListClusterUserCredentials prepares the ListClusterUserCredentials request. -func (c ManagedClustersClient) preparerForListClusterUserCredentials(ctx context.Context, id commonids.KubernetesClusterId, options ListClusterUserCredentialsOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listClusterUserCredential", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListClusterUserCredentials handles the response to the ListClusterUserCredentials request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListClusterUserCredentials(resp *http.Response) (result ListClusterUserCredentialsOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions.go new file mode 100644 index 000000000000..17531ca71d9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions.go @@ -0,0 +1,52 @@ +package managedclusters + +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 ListKubernetesVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *KubernetesVersionListResult +} + +// ListKubernetesVersions ... +func (c ManagedClustersClient) ListKubernetesVersions(ctx context.Context, id LocationId) (result ListKubernetesVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/kubernetesVersions", 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/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions_autorest.go deleted file mode 100644 index 84984757ff18..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listkubernetesversions_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedclusters - -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 ListKubernetesVersionsOperationResponse struct { - HttpResponse *http.Response - Model *KubernetesVersionListResult -} - -// ListKubernetesVersions ... -func (c ManagedClustersClient) ListKubernetesVersions(ctx context.Context, id LocationId) (result ListKubernetesVersionsOperationResponse, err error) { - req, err := c.preparerForListKubernetesVersions(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListKubernetesVersions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListKubernetesVersions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKubernetesVersions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListKubernetesVersions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKubernetesVersions prepares the ListKubernetesVersions request. -func (c ManagedClustersClient) preparerForListKubernetesVersions(ctx context.Context, id LocationId) (*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/kubernetesVersions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKubernetesVersions handles the response to the ListKubernetesVersions request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListKubernetesVersions(resp *http.Response) (result ListKubernetesVersionsOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles.go new file mode 100644 index 000000000000..7e81149691c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles.go @@ -0,0 +1,91 @@ +package managedclusters + +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 ListMeshRevisionProfilesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]MeshRevisionProfile +} + +type ListMeshRevisionProfilesCompleteResult struct { + LatestHttpResponse *http.Response + Items []MeshRevisionProfile +} + +// ListMeshRevisionProfiles ... +func (c ManagedClustersClient) ListMeshRevisionProfiles(ctx context.Context, id LocationId) (result ListMeshRevisionProfilesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/meshRevisionProfiles", 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 *[]MeshRevisionProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListMeshRevisionProfilesComplete retrieves all the results into a single object +func (c ManagedClustersClient) ListMeshRevisionProfilesComplete(ctx context.Context, id LocationId) (ListMeshRevisionProfilesCompleteResult, error) { + return c.ListMeshRevisionProfilesCompleteMatchingPredicate(ctx, id, MeshRevisionProfileOperationPredicate{}) +} + +// ListMeshRevisionProfilesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListMeshRevisionProfilesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate MeshRevisionProfileOperationPredicate) (result ListMeshRevisionProfilesCompleteResult, err error) { + items := make([]MeshRevisionProfile, 0) + + resp, err := c.ListMeshRevisionProfiles(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 = ListMeshRevisionProfilesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles_autorest.go deleted file mode 100644 index 31e337aaa124..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshrevisionprofiles_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package managedclusters - -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 ListMeshRevisionProfilesOperationResponse struct { - HttpResponse *http.Response - Model *[]MeshRevisionProfile - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListMeshRevisionProfilesOperationResponse, error) -} - -type ListMeshRevisionProfilesCompleteResult struct { - Items []MeshRevisionProfile -} - -func (r ListMeshRevisionProfilesOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListMeshRevisionProfilesOperationResponse) LoadMore(ctx context.Context) (resp ListMeshRevisionProfilesOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListMeshRevisionProfiles ... -func (c ManagedClustersClient) ListMeshRevisionProfiles(ctx context.Context, id LocationId) (resp ListMeshRevisionProfilesOperationResponse, err error) { - req, err := c.preparerForListMeshRevisionProfiles(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshRevisionProfiles", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshRevisionProfiles", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListMeshRevisionProfiles(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshRevisionProfiles", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListMeshRevisionProfiles prepares the ListMeshRevisionProfiles request. -func (c ManagedClustersClient) preparerForListMeshRevisionProfiles(ctx context.Context, id LocationId) (*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/meshRevisionProfiles", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListMeshRevisionProfilesWithNextLink prepares the ListMeshRevisionProfiles request with the given nextLink token. -func (c ManagedClustersClient) preparerForListMeshRevisionProfilesWithNextLink(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)) -} - -// responderForListMeshRevisionProfiles handles the response to the ListMeshRevisionProfiles request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListMeshRevisionProfiles(resp *http.Response) (result ListMeshRevisionProfilesOperationResponse, err error) { - type page struct { - Values []MeshRevisionProfile `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 ListMeshRevisionProfilesOperationResponse, err error) { - req, err := c.preparerForListMeshRevisionProfilesWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshRevisionProfiles", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshRevisionProfiles", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListMeshRevisionProfiles(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshRevisionProfiles", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListMeshRevisionProfilesComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListMeshRevisionProfilesComplete(ctx context.Context, id LocationId) (ListMeshRevisionProfilesCompleteResult, error) { - return c.ListMeshRevisionProfilesCompleteMatchingPredicate(ctx, id, MeshRevisionProfileOperationPredicate{}) -} - -// ListMeshRevisionProfilesCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListMeshRevisionProfilesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate MeshRevisionProfileOperationPredicate) (resp ListMeshRevisionProfilesCompleteResult, err error) { - items := make([]MeshRevisionProfile, 0) - - page, err := c.ListMeshRevisionProfiles(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 := ListMeshRevisionProfilesCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles.go new file mode 100644 index 000000000000..56095f44de23 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListMeshUpgradeProfilesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]MeshUpgradeProfile +} + +type ListMeshUpgradeProfilesCompleteResult struct { + LatestHttpResponse *http.Response + Items []MeshUpgradeProfile +} + +// ListMeshUpgradeProfiles ... +func (c ManagedClustersClient) ListMeshUpgradeProfiles(ctx context.Context, id commonids.KubernetesClusterId) (result ListMeshUpgradeProfilesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/meshUpgradeProfiles", 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 *[]MeshUpgradeProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListMeshUpgradeProfilesComplete retrieves all the results into a single object +func (c ManagedClustersClient) ListMeshUpgradeProfilesComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListMeshUpgradeProfilesCompleteResult, error) { + return c.ListMeshUpgradeProfilesCompleteMatchingPredicate(ctx, id, MeshUpgradeProfileOperationPredicate{}) +} + +// ListMeshUpgradeProfilesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListMeshUpgradeProfilesCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MeshUpgradeProfileOperationPredicate) (result ListMeshUpgradeProfilesCompleteResult, err error) { + items := make([]MeshUpgradeProfile, 0) + + resp, err := c.ListMeshUpgradeProfiles(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 = ListMeshUpgradeProfilesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles_autorest.go deleted file mode 100644 index ab7f42c803f1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listmeshupgradeprofiles_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListMeshUpgradeProfilesOperationResponse struct { - HttpResponse *http.Response - Model *[]MeshUpgradeProfile - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListMeshUpgradeProfilesOperationResponse, error) -} - -type ListMeshUpgradeProfilesCompleteResult struct { - Items []MeshUpgradeProfile -} - -func (r ListMeshUpgradeProfilesOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListMeshUpgradeProfilesOperationResponse) LoadMore(ctx context.Context) (resp ListMeshUpgradeProfilesOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListMeshUpgradeProfiles ... -func (c ManagedClustersClient) ListMeshUpgradeProfiles(ctx context.Context, id commonids.KubernetesClusterId) (resp ListMeshUpgradeProfilesOperationResponse, err error) { - req, err := c.preparerForListMeshUpgradeProfiles(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshUpgradeProfiles", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshUpgradeProfiles", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListMeshUpgradeProfiles(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshUpgradeProfiles", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListMeshUpgradeProfiles prepares the ListMeshUpgradeProfiles request. -func (c ManagedClustersClient) preparerForListMeshUpgradeProfiles(ctx context.Context, id commonids.KubernetesClusterId) (*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/meshUpgradeProfiles", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListMeshUpgradeProfilesWithNextLink prepares the ListMeshUpgradeProfiles request with the given nextLink token. -func (c ManagedClustersClient) preparerForListMeshUpgradeProfilesWithNextLink(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)) -} - -// responderForListMeshUpgradeProfiles handles the response to the ListMeshUpgradeProfiles request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListMeshUpgradeProfiles(resp *http.Response) (result ListMeshUpgradeProfilesOperationResponse, err error) { - type page struct { - Values []MeshUpgradeProfile `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 ListMeshUpgradeProfilesOperationResponse, err error) { - req, err := c.preparerForListMeshUpgradeProfilesWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshUpgradeProfiles", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshUpgradeProfiles", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListMeshUpgradeProfiles(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListMeshUpgradeProfiles", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListMeshUpgradeProfilesComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListMeshUpgradeProfilesComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListMeshUpgradeProfilesCompleteResult, error) { - return c.ListMeshUpgradeProfilesCompleteMatchingPredicate(ctx, id, MeshUpgradeProfileOperationPredicate{}) -} - -// ListMeshUpgradeProfilesCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListMeshUpgradeProfilesCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate MeshUpgradeProfileOperationPredicate) (resp ListMeshUpgradeProfilesCompleteResult, err error) { - items := make([]MeshUpgradeProfile, 0) - - page, err := c.ListMeshUpgradeProfiles(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 := ListMeshUpgradeProfilesCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go new file mode 100644 index 000000000000..759383196b88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,92 @@ +package managedclusters + +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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OutboundEnvironmentEndpoint +} + +type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { + LatestHttpResponse *http.Response + Items []OutboundEnvironmentEndpoint +} + +// ListOutboundNetworkDependenciesEndpoints ... +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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 +} + +// ListOutboundNetworkDependenciesEndpointsComplete retrieves all the results into a single object +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate OutboundEnvironmentEndpointOperationPredicate) (result ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + resp, err := c.ListOutboundNetworkDependenciesEndpoints(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 = ListOutboundNetworkDependenciesEndpointsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go deleted file mode 100644 index c3db60df9284..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_listoutboundnetworkdependenciesendpoints_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedclusters - -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 ListOutboundNetworkDependenciesEndpointsOperationResponse struct { - HttpResponse *http.Response - Model *[]OutboundEnvironmentEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOutboundNetworkDependenciesEndpointsOperationResponse, error) -} - -type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { - Items []OutboundEnvironmentEndpoint -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListOutboundNetworkDependenciesEndpoints ... -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpoints(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListOutboundNetworkDependenciesEndpoints prepares the ListOutboundNetworkDependenciesEndpoints request. -func (c ManagedClustersClient) preparerForListOutboundNetworkDependenciesEndpoints(ctx context.Context, id commonids.KubernetesClusterId) (*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)) -} - -// preparerForListOutboundNetworkDependenciesEndpointsWithNextLink prepares the ListOutboundNetworkDependenciesEndpoints request with the given nextLink token. -func (c ManagedClustersClient) preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(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)) -} - -// responderForListOutboundNetworkDependenciesEndpoints handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (c ManagedClustersClient) responderForListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, 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 ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { - req, err := c.preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListOutboundNetworkDependenciesEndpoints(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id commonids.KubernetesClusterId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { - return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) -} - -// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id commonids.KubernetesClusterId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { - items := make([]OutboundEnvironmentEndpoint, 0) - - page, err := c.ListOutboundNetworkDependenciesEndpoints(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 := ListOutboundNetworkDependenciesEndpointsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile.go new file mode 100644 index 000000000000..abdbb59c0189 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 ResetAADProfileOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ResetAADProfile ... +func (c ManagedClustersClient) ResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (result ResetAADProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resetAADProfile", 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 +} + +// ResetAADProfileThenPoll performs ResetAADProfile then polls until it's completed +func (c ManagedClustersClient) ResetAADProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) error { + result, err := c.ResetAADProfile(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ResetAADProfile: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ResetAADProfile: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile_autorest.go deleted file mode 100644 index 5c43129a602b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetaadprofile_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedclusters - -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" - "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 ResetAADProfileOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ResetAADProfile ... -func (c ManagedClustersClient) ResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (result ResetAADProfileOperationResponse, err error) { - req, err := c.preparerForResetAADProfile(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") - return - } - - result, err = c.senderForResetAADProfile(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetAADProfile", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetAADProfileThenPoll performs ResetAADProfile then polls until it's completed -func (c ManagedClustersClient) ResetAADProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) error { - result, err := c.ResetAADProfile(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ResetAADProfile: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ResetAADProfile: %+v", err) - } - - return nil -} - -// preparerForResetAADProfile prepares the ResetAADProfile request. -func (c ManagedClustersClient) preparerForResetAADProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterAADProfile) (*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/resetAADProfile", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResetAADProfile sends the ResetAADProfile request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForResetAADProfile(ctx context.Context, req *http.Request) (future ResetAADProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile.go new file mode 100644 index 000000000000..54589acaf039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 ResetServicePrincipalProfileOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ResetServicePrincipalProfile ... +func (c ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (result ResetServicePrincipalProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/resetServicePrincipalProfile", 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 +} + +// ResetServicePrincipalProfileThenPoll performs ResetServicePrincipalProfile then polls until it's completed +func (c ManagedClustersClient) ResetServicePrincipalProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) error { + result, err := c.ResetServicePrincipalProfile(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ResetServicePrincipalProfile: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ResetServicePrincipalProfile: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go deleted file mode 100644 index 874e24031409..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_resetserviceprincipalprofile_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedclusters - -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" - "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 ResetServicePrincipalProfileOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ResetServicePrincipalProfile ... -func (c ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (result ResetServicePrincipalProfileOperationResponse, err error) { - req, err := c.preparerForResetServicePrincipalProfile(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") - return - } - - result, err = c.senderForResetServicePrincipalProfile(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "ResetServicePrincipalProfile", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetServicePrincipalProfileThenPoll performs ResetServicePrincipalProfile then polls until it's completed -func (c ManagedClustersClient) ResetServicePrincipalProfileThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) error { - result, err := c.ResetServicePrincipalProfile(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ResetServicePrincipalProfile: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ResetServicePrincipalProfile: %+v", err) - } - - return nil -} - -// preparerForResetServicePrincipalProfile prepares the ResetServicePrincipalProfile request. -func (c ManagedClustersClient) preparerForResetServicePrincipalProfile(ctx context.Context, id commonids.KubernetesClusterId, input ManagedClusterServicePrincipalProfile) (*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/resetServicePrincipalProfile", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResetServicePrincipalProfile sends the ResetServicePrincipalProfile request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForResetServicePrincipalProfile(ctx context.Context, req *http.Request) (future ResetServicePrincipalProfileOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates.go new file mode 100644 index 000000000000..3d04938f645d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 RotateClusterCertificatesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RotateClusterCertificates ... +func (c ManagedClustersClient) RotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (result RotateClusterCertificatesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rotateClusterCertificates", 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 +} + +// RotateClusterCertificatesThenPoll performs RotateClusterCertificates then polls until it's completed +func (c ManagedClustersClient) RotateClusterCertificatesThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.RotateClusterCertificates(ctx, id) + if err != nil { + return fmt.Errorf("performing RotateClusterCertificates: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RotateClusterCertificates: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates_autorest.go deleted file mode 100644 index 3dbf6a18a04e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateclustercertificates_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 RotateClusterCertificatesOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RotateClusterCertificates ... -func (c ManagedClustersClient) RotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (result RotateClusterCertificatesOperationResponse, err error) { - req, err := c.preparerForRotateClusterCertificates(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") - return - } - - result, err = c.senderForRotateClusterCertificates(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateClusterCertificates", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RotateClusterCertificatesThenPoll performs RotateClusterCertificates then polls until it's completed -func (c ManagedClustersClient) RotateClusterCertificatesThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.RotateClusterCertificates(ctx, id) - if err != nil { - return fmt.Errorf("performing RotateClusterCertificates: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RotateClusterCertificates: %+v", err) - } - - return nil -} - -// preparerForRotateClusterCertificates prepares the RotateClusterCertificates request. -func (c ManagedClustersClient) preparerForRotateClusterCertificates(ctx context.Context, id commonids.KubernetesClusterId) (*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/rotateClusterCertificates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRotateClusterCertificates sends the RotateClusterCertificates request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRotateClusterCertificates(ctx context.Context, req *http.Request) (future RotateClusterCertificatesOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go new file mode 100644 index 000000000000..b4cecc16d857 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 RotateServiceAccountSigningKeysOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RotateServiceAccountSigningKeys ... +func (c ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (result RotateServiceAccountSigningKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rotateServiceAccountSigningKeys", 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 +} + +// RotateServiceAccountSigningKeysThenPoll performs RotateServiceAccountSigningKeys then polls until it's completed +func (c ManagedClustersClient) RotateServiceAccountSigningKeysThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.RotateServiceAccountSigningKeys(ctx, id) + if err != nil { + return fmt.Errorf("performing RotateServiceAccountSigningKeys: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RotateServiceAccountSigningKeys: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go deleted file mode 100644 index d0806cb35c67..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_rotateserviceaccountsigningkeys_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 RotateServiceAccountSigningKeysOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RotateServiceAccountSigningKeys ... -func (c ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (result RotateServiceAccountSigningKeysOperationResponse, err error) { - req, err := c.preparerForRotateServiceAccountSigningKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateServiceAccountSigningKeys", nil, "Failure preparing request") - return - } - - result, err = c.senderForRotateServiceAccountSigningKeys(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RotateServiceAccountSigningKeys", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RotateServiceAccountSigningKeysThenPoll performs RotateServiceAccountSigningKeys then polls until it's completed -func (c ManagedClustersClient) RotateServiceAccountSigningKeysThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.RotateServiceAccountSigningKeys(ctx, id) - if err != nil { - return fmt.Errorf("performing RotateServiceAccountSigningKeys: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RotateServiceAccountSigningKeys: %+v", err) - } - - return nil -} - -// preparerForRotateServiceAccountSigningKeys prepares the RotateServiceAccountSigningKeys request. -func (c ManagedClustersClient) preparerForRotateServiceAccountSigningKeys(ctx context.Context, id commonids.KubernetesClusterId) (*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/rotateServiceAccountSigningKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRotateServiceAccountSigningKeys sends the RotateServiceAccountSigningKeys request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRotateServiceAccountSigningKeys(ctx context.Context, req *http.Request) (future RotateServiceAccountSigningKeysOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_runcommand.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand.go new file mode 100644 index 000000000000..b64b4ec1b204 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand.go @@ -0,0 +1,76 @@ +package managedclusters + +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/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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c ManagedClustersClient) RunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c ManagedClustersClient) RunCommandThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand_autorest.go deleted file mode 100644 index 52b3f6831890..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_runcommand_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 RunCommandOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *RunCommandResult -} - -// RunCommand ... -func (c ManagedClustersClient) RunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (result RunCommandOperationResponse, err error) { - req, err := c.preparerForRunCommand(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RunCommand", nil, "Failure preparing request") - return - } - - result, err = c.senderForRunCommand(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "RunCommand", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RunCommandThenPoll performs RunCommand then polls until it's completed -func (c ManagedClustersClient) RunCommandThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) error { - result, err := c.RunCommand(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RunCommand: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RunCommand: %+v", err) - } - - return nil -} - -// preparerForRunCommand prepares the RunCommand request. -func (c ManagedClustersClient) preparerForRunCommand(ctx context.Context, id commonids.KubernetesClusterId, input RunCommandRequest) (*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/runCommand", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRunCommand sends the RunCommand request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForRunCommand(ctx context.Context, req *http.Request) (future RunCommandOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start.go new file mode 100644 index 000000000000..ba4549e76155 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c ManagedClustersClient) Start(ctx context.Context, id commonids.KubernetesClusterId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c ManagedClustersClient) StartThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start_autorest.go deleted file mode 100644 index 523cd6864891..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_start_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Start ... -func (c ManagedClustersClient) Start(ctx context.Context, id commonids.KubernetesClusterId) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c ManagedClustersClient) StartThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.Start(ctx, id) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c ManagedClustersClient) preparerForStart(ctx context.Context, id commonids.KubernetesClusterId) (*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/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop.go new file mode 100644 index 000000000000..3bec609e3b46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop.go @@ -0,0 +1,71 @@ +package managedclusters + +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/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 StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Stop ... +func (c ManagedClustersClient) Stop(ctx context.Context, id commonids.KubernetesClusterId) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", 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 +} + +// StopThenPoll performs Stop then polls until it's completed +func (c ManagedClustersClient) StopThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop_autorest.go deleted file mode 100644 index ecd7e737a40d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_stop_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedclusters - -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" - "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 StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Stop ... -func (c ManagedClustersClient) Stop(ctx context.Context, id commonids.KubernetesClusterId) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c ManagedClustersClient) StopThenPoll(ctx context.Context, id commonids.KubernetesClusterId) error { - result, err := c.Stop(ctx, id) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c ManagedClustersClient) preparerForStop(ctx context.Context, id commonids.KubernetesClusterId) (*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/stop", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, 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/containerservice/2023-06-02-preview/managedclusters/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags.go new file mode 100644 index 000000000000..1ed48544bf91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags.go @@ -0,0 +1,75 @@ +package managedclusters + +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/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 UpdateTagsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// UpdateTags ... +func (c ManagedClustersClient) UpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (result UpdateTagsOperationResponse, 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 +} + +// UpdateTagsThenPoll performs UpdateTags then polls until it's completed +func (c ManagedClustersClient) UpdateTagsThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) error { + result, err := c.UpdateTags(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateTags: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateTags: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags_autorest.go deleted file mode 100644 index 6b582645a14c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters/method_updatetags_autorest.go +++ /dev/null @@ -1,81 +0,0 @@ -package managedclusters - -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" - "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 UpdateTagsOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *ManagedCluster -} - -// UpdateTags ... -func (c ManagedClustersClient) UpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdateTags(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedclusters.ManagedClustersClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateTagsThenPoll performs UpdateTags then polls until it's completed -func (c ManagedClustersClient) UpdateTagsThenPoll(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) error { - result, err := c.UpdateTags(ctx, id, input) - if err != nil { - return fmt.Errorf("performing UpdateTags: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after UpdateTags: %+v", err) - } - - return nil -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c ManagedClustersClient) preparerForUpdateTags(ctx context.Context, id commonids.KubernetesClusterId, input TagsObject) (*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)) -} - -// senderForUpdateTags sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClustersClient) senderForUpdateTags(ctx context.Context, req *http.Request) (future UpdateTagsOperationResponse, 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/containerservice/2023-06-02-preview/snapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/client.go index 62d2a1323835..620b7900eab7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/client.go @@ -1,18 +1,26 @@ package snapshots -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 SnapshotsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSnapshotsClientWithBaseURI(endpoint string) SnapshotsClient { - return SnapshotsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) } + + return &SnapshotsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/constants.go index 935113a4de61..73e6fa357a60 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/constants.go @@ -1,6 +1,10 @@ package snapshots -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. @@ -27,6 +31,19 @@ func PossibleValuesForOSSKU() []string { } } +func (s *OSSKU) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSSKU(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSSKU(input string) (*OSSKU, error) { vals := map[string]OSSKU{ "azurelinux": OSSKUAzureLinux, @@ -59,6 +76,19 @@ func PossibleValuesForOSType() []string { } } +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOSType(input string) (*OSType, error) { vals := map[string]OSType{ "linux": OSTypeLinux, @@ -87,6 +117,19 @@ func PossibleValuesForSnapshotType() []string { } } +func (s *SnapshotType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSnapshotType(input string) (*SnapshotType, error) { vals := map[string]SnapshotType{ "managedcluster": SnapshotTypeManagedCluster, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate.go new file mode 100644 index 000000000000..dc9a67647604 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate.go @@ -0,0 +1,56 @@ +package snapshots + +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 *Snapshot +} + +// CreateOrUpdate ... +func (c SnapshotsClient) CreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-06-02-preview/snapshots/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate_autorest.go deleted file mode 100644 index 29d10e44f6e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// CreateOrUpdate ... -func (c SnapshotsClient) CreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SnapshotsClient) preparerForCreateOrUpdate(ctx context.Context, id SnapshotId, input Snapshot) (*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 SnapshotsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/containerservice/2023-06-02-preview/snapshots/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_delete.go new file mode 100644 index 000000000000..575cb8a6929b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_delete.go @@ -0,0 +1,47 @@ +package snapshots + +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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (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/containerservice/2023-06-02-preview/snapshots/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_delete_autorest.go deleted file mode 100644 index 11173f290039..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c SnapshotsClient) preparerForDelete(ctx context.Context, id SnapshotId) (*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 SnapshotsClient) 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/containerservice/2023-06-02-preview/snapshots/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_get.go new file mode 100644 index 000000000000..4f024ded4736 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_get.go @@ -0,0 +1,51 @@ +package snapshots + +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 *Snapshot +} + +// Get ... +func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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/containerservice/2023-06-02-preview/snapshots/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_get_autorest.go deleted file mode 100644 index b328ad1cf52e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SnapshotsClient) preparerForGet(ctx context.Context, id SnapshotId) (*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 SnapshotsClient) 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/containerservice/2023-06-02-preview/snapshots/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list.go new file mode 100644 index 000000000000..bdefce6bb904 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list.go @@ -0,0 +1,92 @@ +package snapshots + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Snapshot +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Snapshot +} + +// List ... +func (c SnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerService/snapshots", 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 *[]Snapshot `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 SnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SnapshotOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Snapshot, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list_autorest.go deleted file mode 100644 index 6222a23b06d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *[]Snapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []Snapshot -} - -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) -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c SnapshotsClient) preparerForList(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.ContainerService/snapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c SnapshotsClient) 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 SnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []Snapshot `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, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c SnapshotsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SnapshotsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SnapshotOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]Snapshot, 0) - - page, err := c.List(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 := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup.go new file mode 100644 index 000000000000..824b8dc7cb6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package snapshots + +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 *[]Snapshot +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Snapshot +} + +// ListByResourceGroup ... +func (c SnapshotsClient) 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.ContainerService/snapshots", 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 *[]Snapshot `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 SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SnapshotOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Snapshot, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f034336ecfe8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package snapshots - -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 *[]Snapshot - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Snapshot -} - -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 SnapshotsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c SnapshotsClient) 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.ContainerService/snapshots", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c SnapshotsClient) 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 SnapshotsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Snapshot `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, "snapshots.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SnapshotOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SnapshotsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SnapshotOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Snapshot, 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/containerservice/2023-06-02-preview/snapshots/method_updatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_updatetags.go new file mode 100644 index 000000000000..19bbc0cf0e74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_updatetags.go @@ -0,0 +1,55 @@ +package snapshots + +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 UpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Snapshot +} + +// UpdateTags ... +func (c SnapshotsClient) UpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (result UpdateTagsOperationResponse, 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/containerservice/2023-06-02-preview/snapshots/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_updatetags_autorest.go deleted file mode 100644 index e370c6b54a58..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots/method_updatetags_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package snapshots - -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 UpdateTagsOperationResponse struct { - HttpResponse *http.Response - Model *Snapshot -} - -// UpdateTags ... -func (c SnapshotsClient) UpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (result UpdateTagsOperationResponse, err error) { - req, err := c.preparerForUpdateTags(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdateTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "UpdateTags", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdateTags prepares the UpdateTags request. -func (c SnapshotsClient) preparerForUpdateTags(ctx context.Context, id SnapshotId, input TagsObject) (*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)) -} - -// responderForUpdateTags handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (c SnapshotsClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, 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/containerservice/2023-10-15/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go index 7b6220896313..477db5a38433 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go @@ -4,11 +4,14 @@ package v2023_10_15 // 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/containerservice/2023-10-15/fleetmembers" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -18,24 +21,35 @@ type Client struct { UpdateRuns *updateruns.UpdateRunsClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - fleetMembersClient := fleetmembers.NewFleetMembersClientWithBaseURI(endpoint) - configureAuthFunc(&fleetMembersClient.Client) - - fleetUpdateStrategiesClient := fleetupdatestrategies.NewFleetUpdateStrategiesClientWithBaseURI(endpoint) - configureAuthFunc(&fleetUpdateStrategiesClient.Client) +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + fleetMembersClient, err := fleetmembers.NewFleetMembersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building FleetMembers client: %+v", err) + } + configureFunc(fleetMembersClient.Client) - fleetsClient := fleets.NewFleetsClientWithBaseURI(endpoint) - configureAuthFunc(&fleetsClient.Client) + fleetUpdateStrategiesClient, err := fleetupdatestrategies.NewFleetUpdateStrategiesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building FleetUpdateStrategies client: %+v", err) + } + configureFunc(fleetUpdateStrategiesClient.Client) - updateRunsClient := updateruns.NewUpdateRunsClientWithBaseURI(endpoint) - configureAuthFunc(&updateRunsClient.Client) + fleetsClient, err := fleets.NewFleetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Fleets client: %+v", err) + } + configureFunc(fleetsClient.Client) - return Client{ - FleetMembers: &fleetMembersClient, - FleetUpdateStrategies: &fleetUpdateStrategiesClient, - Fleets: &fleetsClient, - UpdateRuns: &updateRunsClient, + updateRunsClient, err := updateruns.NewUpdateRunsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building UpdateRuns client: %+v", err) } + configureFunc(updateRunsClient.Client) + + return &Client{ + FleetMembers: fleetMembersClient, + FleetUpdateStrategies: fleetUpdateStrategiesClient, + Fleets: fleetsClient, + UpdateRuns: updateRunsClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go index 6b930a99d629..1f2556b87438 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go @@ -1,18 +1,26 @@ package fleetmembers -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 FleetMembersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewFleetMembersClientWithBaseURI(endpoint string) FleetMembersClient { - return FleetMembersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewFleetMembersClientWithBaseURI(sdkApi sdkEnv.Api) (*FleetMembersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "fleetmembers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FleetMembersClient: %+v", err) } + + return &FleetMembersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go index 4b9b85b42335..e8a926a9d44d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go @@ -1,6 +1,10 @@ package fleetmembers -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. @@ -27,6 +31,19 @@ func PossibleValuesForFleetMemberProvisioningState() []string { } } +func (s *FleetMemberProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFleetMemberProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFleetMemberProvisioningState(input string) (*FleetMemberProvisioningState, error) { vals := map[string]FleetMemberProvisioningState{ "canceled": FleetMemberProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create.go new file mode 100644 index 000000000000..1a5991834f79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create.go @@ -0,0 +1,107 @@ +package fleetmembers + +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 CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *FleetMember +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Create ... +func (c FleetMembersClient) Create(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 +} + +// CreateThenPoll performs Create then polls until it's completed +func (c FleetMembersClient) CreateThenPoll(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) error { + result, err := c.Create(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go deleted file mode 100644 index e1e8e45f2efd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package fleetmembers - -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 CreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *FleetMember -} - -type CreateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Create ... -func (c FleetMembersClient) Create(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c FleetMembersClient) CreateThenPoll(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) error { - result, err := c.Create(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c FleetMembersClient) preparerForCreate(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (*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.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c FleetMembersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, 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/containerservice/2023-10-15/fleetmembers/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete.go new file mode 100644 index 000000000000..7006a5abe506 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete.go @@ -0,0 +1,99 @@ +package fleetmembers + +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 +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c FleetMembersClient) Delete(ctx context.Context, id MemberId, options DeleteOperationOptions) (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(), + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetMembersClient) DeleteThenPoll(ctx context.Context, id MemberId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go deleted file mode 100644 index 14e27998d994..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package fleetmembers - -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 -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c FleetMembersClient) Delete(ctx context.Context, id MemberId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FleetMembersClient) DeleteThenPoll(ctx context.Context, id MemberId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 FleetMembersClient) preparerForDelete(ctx context.Context, id MemberId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetMembersClient) 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/containerservice/2023-10-15/fleetmembers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get.go new file mode 100644 index 000000000000..4ddd179a3b2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get.go @@ -0,0 +1,51 @@ +package fleetmembers + +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 *FleetMember +} + +// Get ... +func (c FleetMembersClient) Get(ctx context.Context, id MemberId) (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/containerservice/2023-10-15/fleetmembers/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go deleted file mode 100644 index b73876337c9c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package fleetmembers - -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 *FleetMember -} - -// Get ... -func (c FleetMembersClient) Get(ctx context.Context, id MemberId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FleetMembersClient) preparerForGet(ctx context.Context, id MemberId) (*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 FleetMembersClient) 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/containerservice/2023-10-15/fleetmembers/method_listbyfleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet.go new file mode 100644 index 000000000000..5347ee738305 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet.go @@ -0,0 +1,91 @@ +package fleetmembers + +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 ListByFleetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]FleetMember +} + +type ListByFleetCompleteResult struct { + LatestHttpResponse *http.Response + Items []FleetMember +} + +// ListByFleet ... +func (c FleetMembersClient) ListByFleet(ctx context.Context, id FleetId) (result ListByFleetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/members", 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 *[]FleetMember `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByFleetComplete retrieves all the results into a single object +func (c FleetMembersClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { + return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetMemberOperationPredicate{}) +} + +// ListByFleetCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetMembersClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetMemberOperationPredicate) (result ListByFleetCompleteResult, err error) { + items := make([]FleetMember, 0) + + resp, err := c.ListByFleet(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 = ListByFleetCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go deleted file mode 100644 index ba31371947ae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package fleetmembers - -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 ListByFleetOperationResponse struct { - HttpResponse *http.Response - Model *[]FleetMember - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByFleetOperationResponse, error) -} - -type ListByFleetCompleteResult struct { - Items []FleetMember -} - -func (r ListByFleetOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByFleetOperationResponse) LoadMore(ctx context.Context) (resp ListByFleetOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByFleet ... -func (c FleetMembersClient) ListByFleet(ctx context.Context, id FleetId) (resp ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByFleet(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByFleet prepares the ListByFleet request. -func (c FleetMembersClient) preparerForListByFleet(ctx context.Context, id FleetId) (*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/members", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByFleetWithNextLink prepares the ListByFleet request with the given nextLink token. -func (c FleetMembersClient) preparerForListByFleetWithNextLink(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)) -} - -// responderForListByFleet handles the response to the ListByFleet request. The method always -// closes the http.Response Body. -func (c FleetMembersClient) responderForListByFleet(resp *http.Response) (result ListByFleetOperationResponse, err error) { - type page struct { - Values []FleetMember `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 ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleetWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByFleet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByFleetComplete retrieves all of the results into a single object -func (c FleetMembersClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { - return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetMemberOperationPredicate{}) -} - -// ListByFleetCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetMembersClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetMemberOperationPredicate) (resp ListByFleetCompleteResult, err error) { - items := make([]FleetMember, 0) - - page, err := c.ListByFleet(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 := ListByFleetCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update.go new file mode 100644 index 000000000000..117dbdfd1488 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update.go @@ -0,0 +1,103 @@ +package fleetmembers + +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 + Model *FleetMember +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c FleetMembersClient) Update(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) (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(), + OptionsObject: options, + } + + 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 FleetMembersClient) UpdateThenPoll(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/containerservice/2023-10-15/fleetmembers/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go deleted file mode 100644 index 2b5251369f05..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package fleetmembers - -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 - Model *FleetMember -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c FleetMembersClient) Update(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c FleetMembersClient) UpdateThenPoll(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - 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 FleetMembersClient) preparerForUpdate(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) (*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.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetMembersClient) 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/containerservice/2023-10-15/fleets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go index db3420827584..199fd2ac0ede 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go @@ -1,18 +1,26 @@ package fleets -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 FleetsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewFleetsClientWithBaseURI(endpoint string) FleetsClient { - return FleetsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewFleetsClientWithBaseURI(sdkApi sdkEnv.Api) (*FleetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "fleets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FleetsClient: %+v", err) } + + return &FleetsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go index e5112ff1390f..1828806155f5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go @@ -1,6 +1,10 @@ package fleets -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. @@ -27,6 +31,19 @@ func PossibleValuesForFleetProvisioningState() []string { } } +func (s *FleetProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFleetProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFleetProvisioningState(input string) (*FleetProvisioningState, error) { vals := map[string]FleetProvisioningState{ "canceled": FleetProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate.go new file mode 100644 index 000000000000..1903621e2e57 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate.go @@ -0,0 +1,107 @@ +package fleets + +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 + Model *Fleet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c FleetsClient) CreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 FleetsClient) CreateOrUpdateThenPoll(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go deleted file mode 100644 index 020950bea14c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package fleets - -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 - Model *Fleet -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c FleetsClient) CreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c FleetsClient) CreateOrUpdateThenPoll(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - 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 FleetsClient) preparerForCreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (*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.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetsClient) 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/containerservice/2023-10-15/fleets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete.go new file mode 100644 index 000000000000..af583413da9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete.go @@ -0,0 +1,99 @@ +package fleets + +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 +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c FleetsClient) Delete(ctx context.Context, id FleetId, options DeleteOperationOptions) (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(), + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetsClient) DeleteThenPoll(ctx context.Context, id FleetId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-10-15/fleets/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go deleted file mode 100644 index 952461b33133..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package fleets - -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 -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c FleetsClient) Delete(ctx context.Context, id FleetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FleetsClient) DeleteThenPoll(ctx context.Context, id FleetId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 FleetsClient) preparerForDelete(ctx context.Context, id FleetId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetsClient) 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/containerservice/2023-10-15/fleets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get.go new file mode 100644 index 000000000000..76cd8b5fd90f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get.go @@ -0,0 +1,51 @@ +package fleets + +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 *Fleet +} + +// Get ... +func (c FleetsClient) Get(ctx context.Context, id FleetId) (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/containerservice/2023-10-15/fleets/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go deleted file mode 100644 index b06413b0122a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package fleets - -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 *Fleet -} - -// Get ... -func (c FleetsClient) Get(ctx context.Context, id FleetId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FleetsClient) preparerForGet(ctx context.Context, id FleetId) (*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 FleetsClient) 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/containerservice/2023-10-15/fleets/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup.go new file mode 100644 index 000000000000..34e0ca6a6cb8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package fleets + +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 *[]Fleet +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Fleet +} + +// ListByResourceGroup ... +func (c FleetsClient) 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.ContainerService/fleets", 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 *[]Fleet `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 FleetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FleetOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Fleet, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 39a257a82e75..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package fleets - -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 *[]Fleet - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Fleet -} - -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 FleetsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c FleetsClient) 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.ContainerService/fleets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c FleetsClient) 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 FleetsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []Fleet `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, "fleets.FleetsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c FleetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FleetOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Fleet, 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/containerservice/2023-10-15/fleets/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription.go new file mode 100644 index 000000000000..b8af61b449c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription.go @@ -0,0 +1,92 @@ +package fleets + +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 *[]Fleet +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []Fleet +} + +// ListBySubscription ... +func (c FleetsClient) 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.ContainerService/fleets", 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 *[]Fleet `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 FleetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FleetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Fleet, 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{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go deleted file mode 100644 index 4139ce3d5ef9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package fleets - -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 *[]Fleet - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []Fleet -} - -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 FleetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c FleetsClient) 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.ContainerService/fleets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c FleetsClient) 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 FleetsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []Fleet `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, "fleets.FleetsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c FleetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FleetOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]Fleet, 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/containerservice/2023-10-15/fleets/method_listcredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials.go new file mode 100644 index 000000000000..6687ee3d8b19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials.go @@ -0,0 +1,52 @@ +package fleets + +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 ListCredentialsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FleetCredentialResults +} + +// ListCredentials ... +func (c FleetsClient) ListCredentials(ctx context.Context, id FleetId) (result ListCredentialsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listCredentials", 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/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go deleted file mode 100644 index 2555b09c591d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package fleets - -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 ListCredentialsOperationResponse struct { - HttpResponse *http.Response - Model *FleetCredentialResults -} - -// ListCredentials ... -func (c FleetsClient) ListCredentials(ctx context.Context, id FleetId) (result ListCredentialsOperationResponse, err error) { - req, err := c.preparerForListCredentials(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListCredentials(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListCredentials prepares the ListCredentials request. -func (c FleetsClient) preparerForListCredentials(ctx context.Context, id FleetId) (*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/listCredentials", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListCredentials handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (c FleetsClient) responderForListCredentials(resp *http.Response) (result ListCredentialsOperationResponse, 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/containerservice/2023-10-15/fleets/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update.go new file mode 100644 index 000000000000..1de05dfae663 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update.go @@ -0,0 +1,103 @@ +package fleets + +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 + Model *Fleet +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c FleetsClient) Update(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (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(), + OptionsObject: options, + } + + 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 FleetsClient) UpdateThenPoll(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/containerservice/2023-10-15/fleets/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go deleted file mode 100644 index a942469f57c0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package fleets - -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 - Model *Fleet -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c FleetsClient) Update(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c FleetsClient) UpdateThenPoll(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - 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 FleetsClient) preparerForUpdate(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (*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.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetsClient) 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/containerservice/2023-10-15/fleetupdatestrategies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/client.go index 0a3e82a874a4..4f33ef884ac1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/client.go @@ -1,18 +1,26 @@ package fleetupdatestrategies -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 FleetUpdateStrategiesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewFleetUpdateStrategiesClientWithBaseURI(endpoint string) FleetUpdateStrategiesClient { - return FleetUpdateStrategiesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewFleetUpdateStrategiesClientWithBaseURI(sdkApi sdkEnv.Api) (*FleetUpdateStrategiesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "fleetupdatestrategies", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FleetUpdateStrategiesClient: %+v", err) } + + return &FleetUpdateStrategiesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/constants.go index f523368a5c3e..a47c36b1cb86 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/constants.go @@ -1,6 +1,10 @@ package fleetupdatestrategies -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 PossibleValuesForFleetUpdateStrategyProvisioningState() []string { } } +func (s *FleetUpdateStrategyProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFleetUpdateStrategyProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseFleetUpdateStrategyProvisioningState(input string) (*FleetUpdateStrategyProvisioningState, error) { vals := map[string]FleetUpdateStrategyProvisioningState{ "canceled": FleetUpdateStrategyProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate.go new file mode 100644 index 000000000000..2b2860734ad2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate.go @@ -0,0 +1,107 @@ +package fleetupdatestrategies + +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 + Model *FleetUpdateStrategy +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c FleetUpdateStrategiesClient) CreateOrUpdate(ctx context.Context, id UpdateStrategyId, input FleetUpdateStrategy, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 FleetUpdateStrategiesClient) CreateOrUpdateThenPoll(ctx context.Context, id UpdateStrategyId, input FleetUpdateStrategy, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate_autorest.go deleted file mode 100644 index d617ded082c0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_createorupdate_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package fleetupdatestrategies - -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 - Model *FleetUpdateStrategy -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c FleetUpdateStrategiesClient) CreateOrUpdate(ctx context.Context, id UpdateStrategyId, input FleetUpdateStrategy, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c FleetUpdateStrategiesClient) CreateOrUpdateThenPoll(ctx context.Context, id UpdateStrategyId, input FleetUpdateStrategy, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - 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 FleetUpdateStrategiesClient) preparerForCreateOrUpdate(ctx context.Context, id UpdateStrategyId, input FleetUpdateStrategy, options CreateOrUpdateOperationOptions) (*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.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetUpdateStrategiesClient) 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/containerservice/2023-10-15/fleetupdatestrategies/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_delete.go new file mode 100644 index 000000000000..430496199d59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_delete.go @@ -0,0 +1,99 @@ +package fleetupdatestrategies + +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 +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c FleetUpdateStrategiesClient) Delete(ctx context.Context, id UpdateStrategyId, options DeleteOperationOptions) (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(), + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetUpdateStrategiesClient) DeleteThenPoll(ctx context.Context, id UpdateStrategyId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-10-15/fleetupdatestrategies/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_delete_autorest.go deleted file mode 100644 index ae9d272a95f9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package fleetupdatestrategies - -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 -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c FleetUpdateStrategiesClient) Delete(ctx context.Context, id UpdateStrategyId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FleetUpdateStrategiesClient) DeleteThenPoll(ctx context.Context, id UpdateStrategyId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 FleetUpdateStrategiesClient) preparerForDelete(ctx context.Context, id UpdateStrategyId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 FleetUpdateStrategiesClient) 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/containerservice/2023-10-15/fleetupdatestrategies/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_get.go new file mode 100644 index 000000000000..7679b5a335fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_get.go @@ -0,0 +1,51 @@ +package fleetupdatestrategies + +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 *FleetUpdateStrategy +} + +// Get ... +func (c FleetUpdateStrategiesClient) Get(ctx context.Context, id UpdateStrategyId) (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/containerservice/2023-10-15/fleetupdatestrategies/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_get_autorest.go deleted file mode 100644 index 8aa71ed7aabe..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package fleetupdatestrategies - -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 *FleetUpdateStrategy -} - -// Get ... -func (c FleetUpdateStrategiesClient) Get(ctx context.Context, id UpdateStrategyId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FleetUpdateStrategiesClient) preparerForGet(ctx context.Context, id UpdateStrategyId) (*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 FleetUpdateStrategiesClient) 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/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet.go new file mode 100644 index 000000000000..7c0f3a0af721 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet.go @@ -0,0 +1,91 @@ +package fleetupdatestrategies + +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 ListByFleetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]FleetUpdateStrategy +} + +type ListByFleetCompleteResult struct { + LatestHttpResponse *http.Response + Items []FleetUpdateStrategy +} + +// ListByFleet ... +func (c FleetUpdateStrategiesClient) ListByFleet(ctx context.Context, id FleetId) (result ListByFleetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/updateStrategies", 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 *[]FleetUpdateStrategy `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByFleetComplete retrieves all the results into a single object +func (c FleetUpdateStrategiesClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { + return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetUpdateStrategyOperationPredicate{}) +} + +// ListByFleetCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FleetUpdateStrategiesClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetUpdateStrategyOperationPredicate) (result ListByFleetCompleteResult, err error) { + items := make([]FleetUpdateStrategy, 0) + + resp, err := c.ListByFleet(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 = ListByFleetCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet_autorest.go deleted file mode 100644 index 88cb6a179aa4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/method_listbyfleet_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package fleetupdatestrategies - -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 ListByFleetOperationResponse struct { - HttpResponse *http.Response - Model *[]FleetUpdateStrategy - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByFleetOperationResponse, error) -} - -type ListByFleetCompleteResult struct { - Items []FleetUpdateStrategy -} - -func (r ListByFleetOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByFleetOperationResponse) LoadMore(ctx context.Context) (resp ListByFleetOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByFleet ... -func (c FleetUpdateStrategiesClient) ListByFleet(ctx context.Context, id FleetId) (resp ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "ListByFleet", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "ListByFleet", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByFleet(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "ListByFleet", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByFleet prepares the ListByFleet request. -func (c FleetUpdateStrategiesClient) preparerForListByFleet(ctx context.Context, id FleetId) (*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/updateStrategies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByFleetWithNextLink prepares the ListByFleet request with the given nextLink token. -func (c FleetUpdateStrategiesClient) preparerForListByFleetWithNextLink(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)) -} - -// responderForListByFleet handles the response to the ListByFleet request. The method always -// closes the http.Response Body. -func (c FleetUpdateStrategiesClient) responderForListByFleet(resp *http.Response) (result ListByFleetOperationResponse, err error) { - type page struct { - Values []FleetUpdateStrategy `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 ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleetWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "ListByFleet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "ListByFleet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByFleet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "fleetupdatestrategies.FleetUpdateStrategiesClient", "ListByFleet", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByFleetComplete retrieves all of the results into a single object -func (c FleetUpdateStrategiesClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { - return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetUpdateStrategyOperationPredicate{}) -} - -// ListByFleetCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FleetUpdateStrategiesClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetUpdateStrategyOperationPredicate) (resp ListByFleetCompleteResult, err error) { - items := make([]FleetUpdateStrategy, 0) - - page, err := c.ListByFleet(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 := ListByFleetCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go index c96c9b6c0e26..a5becca3c6b3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go @@ -1,18 +1,26 @@ package updateruns -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 UpdateRunsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUpdateRunsClientWithBaseURI(endpoint string) UpdateRunsClient { - return UpdateRunsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUpdateRunsClientWithBaseURI(sdkApi sdkEnv.Api) (*UpdateRunsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "updateruns", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UpdateRunsClient: %+v", err) } + + return &UpdateRunsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go index 2bc246c8f0a5..2924734f139d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go @@ -1,6 +1,10 @@ package updateruns -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 PossibleValuesForManagedClusterUpgradeType() []string { } } +func (s *ManagedClusterUpgradeType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedClusterUpgradeType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedClusterUpgradeType(input string) (*ManagedClusterUpgradeType, error) { vals := map[string]ManagedClusterUpgradeType{ "full": ManagedClusterUpgradeTypeFull, @@ -47,6 +64,19 @@ func PossibleValuesForNodeImageSelectionType() []string { } } +func (s *NodeImageSelectionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNodeImageSelectionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNodeImageSelectionType(input string) (*NodeImageSelectionType, error) { vals := map[string]NodeImageSelectionType{ "consistent": NodeImageSelectionTypeConsistent, @@ -77,6 +107,19 @@ func PossibleValuesForUpdateRunProvisioningState() []string { } } +func (s *UpdateRunProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpdateRunProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpdateRunProvisioningState(input string) (*UpdateRunProvisioningState, error) { vals := map[string]UpdateRunProvisioningState{ "canceled": UpdateRunProvisioningStateCanceled, @@ -116,6 +159,19 @@ func PossibleValuesForUpdateState() []string { } } +func (s *UpdateState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpdateState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUpdateState(input string) (*UpdateState, error) { vals := map[string]UpdateState{ "completed": UpdateStateCompleted, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate.go new file mode 100644 index 000000000000..1b8012b44a02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate.go @@ -0,0 +1,107 @@ +package updateruns + +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 + Model *UpdateRun +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c UpdateRunsClient) CreateOrUpdate(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 UpdateRunsClient) CreateOrUpdateThenPoll(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go deleted file mode 100644 index ab89ab2ac4d9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package updateruns - -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 - Model *UpdateRun -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c UpdateRunsClient) CreateOrUpdate(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c UpdateRunsClient) CreateOrUpdateThenPoll(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - 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 UpdateRunsClient) preparerForCreateOrUpdate(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) (*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.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 UpdateRunsClient) 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/containerservice/2023-10-15/updateruns/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete.go new file mode 100644 index 000000000000..9f04055a3afe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete.go @@ -0,0 +1,99 @@ +package updateruns + +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 +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c UpdateRunsClient) Delete(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) (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(), + 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c UpdateRunsClient) DeleteThenPoll(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/containerservice/2023-10-15/updateruns/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go deleted file mode 100644 index 63866ee9e525..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go +++ /dev/null @@ -1,107 +0,0 @@ -package updateruns - -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 -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c UpdateRunsClient) Delete(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c UpdateRunsClient) DeleteThenPoll(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - 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 UpdateRunsClient) preparerForDelete(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) (*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.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - 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 UpdateRunsClient) 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/containerservice/2023-10-15/updateruns/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get.go new file mode 100644 index 000000000000..64d0f910e25d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get.go @@ -0,0 +1,51 @@ +package updateruns + +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 *UpdateRun +} + +// Get ... +func (c UpdateRunsClient) Get(ctx context.Context, id UpdateRunId) (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/containerservice/2023-10-15/updateruns/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go deleted file mode 100644 index 3f90f184de3b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package updateruns - -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 *UpdateRun -} - -// Get ... -func (c UpdateRunsClient) Get(ctx context.Context, id UpdateRunId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c UpdateRunsClient) preparerForGet(ctx context.Context, id UpdateRunId) (*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 UpdateRunsClient) 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/containerservice/2023-10-15/updateruns/method_listbyfleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet.go new file mode 100644 index 000000000000..88c825135ba5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet.go @@ -0,0 +1,91 @@ +package updateruns + +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 ListByFleetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UpdateRun +} + +type ListByFleetCompleteResult struct { + LatestHttpResponse *http.Response + Items []UpdateRun +} + +// ListByFleet ... +func (c UpdateRunsClient) ListByFleet(ctx context.Context, id FleetId) (result ListByFleetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/updateRuns", 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 *[]UpdateRun `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByFleetComplete retrieves all the results into a single object +func (c UpdateRunsClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { + return c.ListByFleetCompleteMatchingPredicate(ctx, id, UpdateRunOperationPredicate{}) +} + +// ListByFleetCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UpdateRunsClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate UpdateRunOperationPredicate) (result ListByFleetCompleteResult, err error) { + items := make([]UpdateRun, 0) + + resp, err := c.ListByFleet(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 = ListByFleetCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go deleted file mode 100644 index e842748c4664..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package updateruns - -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 ListByFleetOperationResponse struct { - HttpResponse *http.Response - Model *[]UpdateRun - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByFleetOperationResponse, error) -} - -type ListByFleetCompleteResult struct { - Items []UpdateRun -} - -func (r ListByFleetOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByFleetOperationResponse) LoadMore(ctx context.Context) (resp ListByFleetOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByFleet ... -func (c UpdateRunsClient) ListByFleet(ctx context.Context, id FleetId) (resp ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByFleet(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByFleet prepares the ListByFleet request. -func (c UpdateRunsClient) preparerForListByFleet(ctx context.Context, id FleetId) (*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/updateRuns", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByFleetWithNextLink prepares the ListByFleet request with the given nextLink token. -func (c UpdateRunsClient) preparerForListByFleetWithNextLink(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)) -} - -// responderForListByFleet handles the response to the ListByFleet request. The method always -// closes the http.Response Body. -func (c UpdateRunsClient) responderForListByFleet(resp *http.Response) (result ListByFleetOperationResponse, err error) { - type page struct { - Values []UpdateRun `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 ListByFleetOperationResponse, err error) { - req, err := c.preparerForListByFleetWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByFleet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByFleetComplete retrieves all of the results into a single object -func (c UpdateRunsClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { - return c.ListByFleetCompleteMatchingPredicate(ctx, id, UpdateRunOperationPredicate{}) -} - -// ListByFleetCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UpdateRunsClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate UpdateRunOperationPredicate) (resp ListByFleetCompleteResult, err error) { - items := make([]UpdateRun, 0) - - page, err := c.ListByFleet(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 := ListByFleetCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start.go new file mode 100644 index 000000000000..a11200b431a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start.go @@ -0,0 +1,99 @@ +package updateruns + +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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *UpdateRun +} + +type StartOperationOptions struct { + IfMatch *string +} + +func DefaultStartOperationOptions() StartOperationOptions { + return StartOperationOptions{} +} + +func (o StartOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o StartOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o StartOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Start ... +func (c UpdateRunsClient) Start(ctx context.Context, id UpdateRunId, options StartOperationOptions) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c UpdateRunsClient) StartThenPoll(ctx context.Context, id UpdateRunId, options StartOperationOptions) error { + result, err := c.Start(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go deleted file mode 100644 index 279e803fecc3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package updateruns - -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 StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *UpdateRun -} - -type StartOperationOptions struct { - IfMatch *string -} - -func DefaultStartOperationOptions() StartOperationOptions { - return StartOperationOptions{} -} - -func (o StartOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o StartOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Start ... -func (c UpdateRunsClient) Start(ctx context.Context, id UpdateRunId, options StartOperationOptions) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c UpdateRunsClient) StartThenPoll(ctx context.Context, id UpdateRunId, options StartOperationOptions) error { - result, err := c.Start(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c UpdateRunsClient) preparerForStart(ctx context.Context, id UpdateRunId, options StartOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c UpdateRunsClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, 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/containerservice/2023-10-15/updateruns/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop.go new file mode 100644 index 000000000000..43953872960a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop.go @@ -0,0 +1,99 @@ +package updateruns + +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 StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *UpdateRun +} + +type StopOperationOptions struct { + IfMatch *string +} + +func DefaultStopOperationOptions() StopOperationOptions { + return StopOperationOptions{} +} + +func (o StopOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o StopOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o StopOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Stop ... +func (c UpdateRunsClient) Stop(ctx context.Context, id UpdateRunId, options StopOperationOptions) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", 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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StopThenPoll performs Stop then polls until it's completed +func (c UpdateRunsClient) StopThenPoll(ctx context.Context, id UpdateRunId, options StopOperationOptions) error { + result, err := c.Stop(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go deleted file mode 100644 index 09d350569eb7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package updateruns - -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 StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *UpdateRun -} - -type StopOperationOptions struct { - IfMatch *string -} - -func DefaultStopOperationOptions() StopOperationOptions { - return StopOperationOptions{} -} - -func (o StopOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o StopOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Stop ... -func (c UpdateRunsClient) Stop(ctx context.Context, id UpdateRunId, options StopOperationOptions) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c UpdateRunsClient) StopThenPoll(ctx context.Context, id UpdateRunId, options StopOperationOptions) error { - result, err := c.Stop(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c UpdateRunsClient) preparerForStop(ctx context.Context, id UpdateRunId, options StopOperationOptions) (*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.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c UpdateRunsClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, 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/modules.txt b/vendor/modules.txt index 29ff0f669f95..8b98bd19e00e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -153,7 +153,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/resource-manager v0.20240212.1141705 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20240213.1120950 ## explicit; go 1.21 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 @@ -1043,7 +1043,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/resourceprovid github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/webapps github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01 github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01/webpubsub -# github.com/hashicorp/go-azure-sdk/sdk v0.20240212.1141705 +# github.com/hashicorp/go-azure-sdk/sdk v0.20240213.1120950 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/sdk/auth github.com/hashicorp/go-azure-sdk/sdk/auth/autorest