From 0fe0ae7ccd85ee93d7f7ead3ba3ff14163c457f9 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 13:33:03 -0700 Subject: [PATCH 01/12] swap azurerm_mysql_configuration to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 15 +- .../mysql/mysql_configuration_resource.go | 63 +- .../mysql_configuration_resource_test.go | 46 +- .../services/mysql/parse/configuration.go | 78 --- .../mysql/parse/configuration_test.go | 131 ---- internal/services/mysql/resourceids.go | 1 - .../mysql/validate/configuration_id.go | 26 - .../mysql/validate/configuration_id_test.go | 91 --- .../checknameavailability/README.md | 41 ++ .../checknameavailability/client.go | 26 + .../checknameavailability/method_execute.go | 57 ++ .../model_nameavailability.go | 10 + .../model_nameavailabilityrequest.go | 9 + .../checknameavailability/version.go | 12 + .../mysql/2017-12-01/client.go | 154 +++++ .../mysql/2017-12-01/configurations/README.md | 69 +++ .../mysql/2017-12-01/configurations/client.go | 26 + .../configurations/id_configuration.go | 140 +++++ .../2017-12-01/configurations/id_server.go | 127 ++++ .../configurations/method_createorupdate.go | 74 +++ .../2017-12-01/configurations/method_get.go | 51 ++ .../configurations/method_listbyserver.go | 52 ++ .../configurations/model_configuration.go | 11 + .../model_configurationlistresult.go | 8 + .../model_configurationproperties.go | 13 + .../2017-12-01/configurations/version.go | 12 + .../2017-12-01/configurationsupdate/README.md | 37 ++ .../2017-12-01/configurationsupdate/client.go | 26 + .../configurationsupdate/id_server.go | 127 ++++ ...erverparameterslistupdateconfigurations.go | 74 +++ .../model_configuration.go | 11 + .../model_configurationlistresult.go | 8 + .../model_configurationproperties.go | 13 + .../configurationsupdate/version.go | 12 + .../mysql/2017-12-01/databases/README.md | 81 +++ .../mysql/2017-12-01/databases/client.go | 26 + .../mysql/2017-12-01/databases/id_database.go | 140 +++++ .../mysql/2017-12-01/databases/id_server.go | 127 ++++ .../databases/method_createorupdate.go | 75 +++ .../2017-12-01/databases/method_delete.go | 71 +++ .../mysql/2017-12-01/databases/method_get.go | 51 ++ .../databases/method_listbyserver.go | 52 ++ .../2017-12-01/databases/model_database.go | 11 + .../databases/model_databaselistresult.go | 8 + .../databases/model_databaseproperties.go | 9 + .../mysql/2017-12-01/databases/version.go | 12 + .../mysql/2017-12-01/firewallrules/README.md | 81 +++ .../mysql/2017-12-01/firewallrules/client.go | 26 + .../firewallrules/id_firewallrule.go | 140 +++++ .../2017-12-01/firewallrules/id_server.go | 127 ++++ .../firewallrules/method_createorupdate.go | 75 +++ .../2017-12-01/firewallrules/method_delete.go | 71 +++ .../2017-12-01/firewallrules/method_get.go | 51 ++ .../firewallrules/method_listbyserver.go | 52 ++ .../firewallrules/model_firewallrule.go | 11 + .../model_firewallrulelistresult.go | 8 + .../model_firewallruleproperties.go | 9 + .../mysql/2017-12-01/firewallrules/version.go | 12 + .../locationbasedperformancetier/README.md | 36 ++ .../locationbasedperformancetier/client.go | 26 + .../id_location.go | 114 ++++ .../method_list.go | 52 ++ .../model_performancetierlistresult.go | 8 + .../model_performancetierproperties.go | 15 + ...l_performancetierservicelevelobjectives.go | 15 + .../locationbasedperformancetier/version.go | 12 + .../mysql/2017-12-01/logfiles/README.md | 36 ++ .../mysql/2017-12-01/logfiles/client.go | 26 + .../mysql/2017-12-01/logfiles/id_server.go | 127 ++++ .../logfiles/method_listbyserver.go | 52 ++ .../2017-12-01/logfiles/model_logfile.go | 11 + .../logfiles/model_logfilelistresult.go | 8 + .../logfiles/model_logfileproperties.go | 42 ++ .../mysql/2017-12-01/logfiles/version.go | 12 + .../2017-12-01/recoverableservers/README.md | 36 ++ .../2017-12-01/recoverableservers/client.go | 26 + .../recoverableservers/id_server.go | 127 ++++ .../recoverableservers/method_get.go | 52 ++ .../model_recoverableserverproperties.go | 13 + .../model_recoverableserverresource.go | 11 + .../2017-12-01/recoverableservers/version.go | 12 + .../mysql/2017-12-01/replicas/README.md | 36 ++ .../mysql/2017-12-01/replicas/client.go | 26 + .../mysql/2017-12-01/replicas/constants.go | 532 ++++++++++++++++ .../mysql/2017-12-01/replicas/id_server.go | 127 ++++ .../replicas/method_listbyserver.go | 52 ++ .../replicas/model_privateendpointproperty.go | 8 + .../mysql/2017-12-01/replicas/model_server.go | 19 + .../replicas/model_serverlistresult.go | 8 + .../model_serverprivateendpointconnection.go | 9 + ...rverprivateendpointconnectionproperties.go | 10 + ...ivatelinkserviceconnectionstateproperty.go | 10 + .../replicas/model_serverproperties.go | 40 ++ .../mysql/2017-12-01/replicas/model_sku.go | 12 + .../replicas/model_storageprofile.go | 11 + .../mysql/2017-12-01/replicas/version.go | 12 + .../2017-12-01/serveradministrators/README.md | 81 +++ .../2017-12-01/serveradministrators/client.go | 26 + .../serveradministrators/constants.go | 48 ++ .../serveradministrators/id_server.go | 127 ++++ .../method_createorupdate.go | 74 +++ .../serveradministrators/method_delete.go | 71 +++ .../serveradministrators/method_get.go | 52 ++ .../serveradministrators/method_list.go | 52 ++ .../model_serveradministratorproperties.go | 11 + .../model_serveradministratorresource.go | 11 + ...l_serveradministratorresourcelistresult.go | 8 + .../serveradministrators/version.go | 12 + .../serverbasedperformancetier/README.md | 36 ++ .../serverbasedperformancetier/client.go | 26 + .../serverbasedperformancetier/id_server.go | 127 ++++ .../serverbasedperformancetier/method_list.go | 52 ++ .../model_performancetierlistresult.go | 8 + .../model_performancetierproperties.go | 15 + ...l_performancetierservicelevelobjectives.go | 15 + .../serverbasedperformancetier/version.go | 12 + .../mysql/2017-12-01/serverrestart/client.go | 26 + .../2017-12-01/serverrestart/id_server.go | 127 ++++ .../serverrestart/method_serversrestart.go | 70 +++ .../mysql/2017-12-01/serverrestart/version.go | 12 + .../mysql/2017-12-01/servers/README.md | 114 ++++ .../mysql/2017-12-01/servers/client.go | 26 + .../mysql/2017-12-01/servers/constants.go | 579 ++++++++++++++++++ .../mysql/2017-12-01/servers/id_server.go | 127 ++++ .../mysql/2017-12-01/servers/method_create.go | 75 +++ .../mysql/2017-12-01/servers/method_delete.go | 71 +++ .../mysql/2017-12-01/servers/method_get.go | 51 ++ .../mysql/2017-12-01/servers/method_list.go | 53 ++ .../servers/method_listbyresourcegroup.go | 53 ++ .../mysql/2017-12-01/servers/method_update.go | 74 +++ .../servers/model_privateendpointproperty.go | 8 + .../mysql/2017-12-01/servers/model_server.go | 19 + .../servers/model_serverforcreate.go | 48 ++ .../servers/model_serverlistresult.go | 8 + .../model_serverprivateendpointconnection.go | 9 + ...rverprivateendpointconnectionproperties.go | 10 + ...ivatelinkserviceconnectionstateproperty.go | 10 + .../servers/model_serverproperties.go | 40 ++ .../model_serverpropertiesforcreate.go | 72 +++ .../model_serverpropertiesfordefaultcreate.go | 48 ++ .../model_serverpropertiesforgeorestore.go | 47 ++ .../model_serverpropertiesforreplica.go | 47 ++ .../model_serverpropertiesforrestore.go | 48 ++ .../servers/model_serverupdateparameters.go | 15 + .../model_serverupdateparametersproperties.go | 14 + .../mysql/2017-12-01/servers/model_sku.go | 12 + .../servers/model_storageprofile.go | 11 + .../mysql/2017-12-01/servers/version.go | 12 + .../serversecurityalertpolicies/README.md | 70 +++ .../serversecurityalertpolicies/client.go | 26 + .../serversecurityalertpolicies/constants.go | 51 ++ .../serversecurityalertpolicies/id_server.go | 127 ++++ .../method_createorupdate.go | 74 +++ .../serversecurityalertpolicies/method_get.go | 52 ++ .../method_listbyserver.go | 89 +++ .../model_securityalertpolicyproperties.go | 14 + .../model_serversecurityalertpolicy.go | 11 + .../serversecurityalertpolicies/predicates.go | 27 + .../serversecurityalertpolicies/version.go | 12 + .../2017-12-01/virtualnetworkrules/README.md | 82 +++ .../2017-12-01/virtualnetworkrules/client.go | 26 + .../virtualnetworkrules/constants.go | 60 ++ .../virtualnetworkrules/id_server.go | 127 ++++ .../id_virtualnetworkrule.go | 140 +++++ .../method_createorupdate.go | 75 +++ .../virtualnetworkrules/method_delete.go | 71 +++ .../virtualnetworkrules/method_get.go | 51 ++ .../method_listbyserver.go | 89 +++ .../model_virtualnetworkrule.go | 11 + .../model_virtualnetworkruleproperties.go | 10 + .../virtualnetworkrules/predicates.go | 27 + .../2017-12-01/virtualnetworkrules/version.go | 12 + vendor/modules.txt | 16 + 173 files changed, 8525 insertions(+), 383 deletions(-) delete mode 100644 internal/services/mysql/parse/configuration.go delete mode 100644 internal/services/mysql/parse/configuration_test.go delete mode 100644 internal/services/mysql/validate/configuration_id.go delete mode 100644 internal/services/mysql/validate/configuration_id_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/method_execute.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailability.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailabilityrequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_configuration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configuration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/method_serverparameterslistupdateconfigurations.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configuration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaselistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrulelistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallruleproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierservicelevelobjectives.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfilelistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfileproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_privateendpointproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_sku.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_storageprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierservicelevelobjectives.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/method_serversrestart.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_privateendpointproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverforcreate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforcreate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforgeorestore.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforreplica.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforrestore.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparametersproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_sku.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_storageprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_listbyserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/version.go diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index a54fc8058449..d1562c16bc5c 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + servers_v2017_12_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01" flexibleServers_v2021_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/azureadadministrators" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" @@ -15,8 +16,8 @@ import ( type Client struct { FlexibleServers *flexibleServers_v2021_05_01.Client + MySqlClient *servers_v2017_12_01.Client - ConfigurationsClient *mysql.ConfigurationsClient DatabasesClient *mysql.DatabasesClient FirewallRulesClient *mysql.FirewallRulesClient ServersClient *mysql.ServersClient @@ -37,15 +38,19 @@ func NewClient(o *common.ClientOptions) (*Client, error) { return nil, fmt.Errorf("building Flexible Servers client: %+v", err) } + mySqlMetaClient, err := servers_v2017_12_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building MySql client: %+v", err) + } + azureADAdministratorsClient, err := azureadadministrators.NewAzureADAdministratorsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { return nil, fmt.Errorf("building Azure AD Administrators client: %+v", err) } o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) - ConfigurationsClient := mysql.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ConfigurationsClient.Client, o.ResourceManagerAuthorizer) - DatabasesClient := mysql.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&DatabasesClient.Client, o.ResourceManagerAuthorizer) @@ -69,10 +74,10 @@ func NewClient(o *common.ClientOptions) (*Client, error) { return &Client{ FlexibleServers: flexibleServersMetaClient, + MySqlClient: mySqlMetaClient, // TODO: switch to using the Meta Clients AzureADAdministratorsClient: azureADAdministratorsClient, - ConfigurationsClient: &ConfigurationsClient, DatabasesClient: &DatabasesClient, FirewallRulesClient: &FirewallRulesClient, ServersClient: &ServersClient, diff --git a/internal/services/mysql/mysql_configuration_resource.go b/internal/services/mysql/mysql_configuration_resource.go index 10ccd6f1ad00..352e00cc860d 100644 --- a/internal/services/mysql/mysql_configuration_resource.go +++ b/internal/services/mysql/mysql_configuration_resource.go @@ -8,10 +8,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -25,7 +25,7 @@ func resourceMySQLConfiguration() *pluginsdk.Resource { Delete: resourceMySQLConfigurationDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ConfigurationID(id) + _, err := configurations.ParseConfigurationID(id) return err }), @@ -62,15 +62,15 @@ func resourceMySQLConfiguration() *pluginsdk.Resource { } func resourceMySQLConfigurationCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ConfigurationsClient + client := meta.(*clients.Client).MySQL.MySqlClient.Configurations subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() log.Printf("[INFO] preparing arguments for AzureRM MySQL Configuration creation.") - properties := mysql.Configuration{ - ConfigurationProperties: &mysql.ConfigurationProperties{ + properties := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ Value: utils.String(d.Get("value").(string)), }, } @@ -78,33 +78,28 @@ func resourceMySQLConfigurationCreate(d *pluginsdk.ResourceData, meta interface{ // NOTE: this resource intentionally doesn't support Requires Import // since a fallback route is created by default - id := parse.NewConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + id := configurations.NewConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating %s: %v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %v", id, err) - } - d.SetId(id.ID()) return resourceMySQLConfigurationRead(d, meta) } func resourceMySQLConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ConfigurationsClient + client := meta.(*clients.Client).MySQL.MySqlClient.Configurations ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found", id) d.SetId("") return nil @@ -113,12 +108,15 @@ func resourceMySQLConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) + d.Set("name", id.ConfigurationName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) value := "" - if props := resp.ConfigurationProperties; props != nil && props.Value != nil { - value = *props.Value + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil && props.Value != nil { + value = *props.Value + } } d.Set("value", value) @@ -126,31 +124,30 @@ func resourceMySQLConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) } func resourceMySQLConfigurationDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ConfigurationsClient + client := meta.(*clients.Client).MySQL.MySqlClient.Configurations ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } // "delete" = resetting this to the default value - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } + defaultValue := "" + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.Value != nil { + defaultValue = *resp.Model.Properties.Value + } - properties := mysql.Configuration{ - ConfigurationProperties: &mysql.ConfigurationProperties{ + properties := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ // we can alternatively set `source: "system-default"` - Value: resp.DefaultValue, + Value: utils.String(defaultValue), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { - return err - } - - return future.WaitForCompletionRef(ctx, client.Client) + return client.CreateOrUpdateThenPoll(ctx, *id, properties) } diff --git a/internal/services/mysql/mysql_configuration_resource_test.go b/internal/services/mysql/mysql_configuration_resource_test.go index 6638615435fb..8ad9457b8e8a 100644 --- a/internal/services/mysql/mysql_configuration_resource_test.go +++ b/internal/services/mysql/mysql_configuration_resource_test.go @@ -8,9 +8,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -84,36 +85,41 @@ func TestAccMySQLConfiguration_logSlowAdminStatements(t *testing.T) { } func (t MySQLConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ConfigurationID(state.ID) + id, err := configurations.ParseConfigurationID(state.ID) if err != nil { return nil, err } - resp, err := clients.MySQL.ConfigurationsClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading MySQL Configuration (%s): %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r MySQLConfigurationResource) checkReset(configurationName string) acceptance.ClientCheckFunc { return func(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) error { - id, err := parse.ServerID(state.Attributes["id"]) + serverId, err := configurations.ParseServerID(state.Attributes["id"]) if err != nil { return err } - resp, err := clients.MySQL.ConfigurationsClient.Get(ctx, id.ResourceGroup, id.Name, configurationName) + configurationId := configurations.NewConfigurationID(serverId.SubscriptionId, serverId.ResourceGroupName, serverId.ServerName, configurationName) + + resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx, configurationId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Bad: MySQL Configuration %q (server %q resource group: %q) does not exist", configurationName, id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s does not exist", configurationId) } - return fmt.Errorf("Bad: Get on mysqlConfigurationsClient: %+v", err) + return fmt.Errorf("get on mysqlConfigurationsClient: %+v", err) } - actualValue := *resp.Value - defaultValue := *resp.DefaultValue + if resp.Model == nil || resp.Model.Properties == nil || resp.Model.Properties.Value == nil || resp.Model.Properties.DefaultValue == nil { + return fmt.Errorf("one of model/properties/value/defaultValue was nil for %s", configurationId) + } + actualValue := *resp.Model.Properties.Value + defaultValue := *resp.Model.Properties.DefaultValue if defaultValue != actualValue { return fmt.Errorf("MySQL Configuration wasn't set to the default value. Expected '%s' - got '%s': \n%+v", defaultValue, actualValue, resp) @@ -125,22 +131,26 @@ func (r MySQLConfigurationResource) checkReset(configurationName string) accepta func (r MySQLConfigurationResource) checkValue(value string) acceptance.ClientCheckFunc { return func(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) error { - id, err := parse.ConfigurationID(state.Attributes["id"]) + id, err := configurations.ParseConfigurationID(state.Attributes["id"]) if err != nil { return err } - resp, err := clients.MySQL.ConfigurationsClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Bad: MySQL Configuration %q (server %q resource group: %q) does not exist", id.Name, id.ServerName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s does not exist", id) } - return fmt.Errorf("Bad: Get on mysqlConfigurationsClient: %+v", err) + return fmt.Errorf("get on mysqlConfigurationsClient: %+v", err) + } + + if resp.Model == nil || resp.Model.Properties == nil || resp.Model.Properties.Value == nil { + return fmt.Errorf("one of model/properties/value was nil for %s", id) } - if *resp.Value != value { - return fmt.Errorf("MySQL Configuration wasn't set. Expected '%s' - got '%s': \n%+v", value, *resp.Value, resp) + if *resp.Model.Properties.Value != value { + return fmt.Errorf("MySQL Configuration wasn't set. Expected '%s' - got '%s': \n%+v", value, *resp.Model.Properties.Value, resp) } return nil diff --git a/internal/services/mysql/parse/configuration.go b/internal/services/mysql/parse/configuration.go deleted file mode 100644 index 2cbf5f05526b..000000000000 --- a/internal/services/mysql/parse/configuration.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ConfigurationId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewConfigurationID(subscriptionId, resourceGroup, serverName, name string) ConfigurationId { - return ConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id ConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Configuration", segmentsStr) -} - -func (id ConfigurationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/configurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// ConfigurationID parses a Configuration ID into an ConfigurationId struct -func ConfigurationID(input string) (*ConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an Configuration ID: %+v", input, err) - } - - resourceId := ConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("configurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/mysql/parse/configuration_test.go b/internal/services/mysql/parse/configuration_test.go deleted file mode 100644 index 6e7163d2c3e9..000000000000 --- a/internal/services/mysql/parse/configuration_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ConfigurationId{} - -func TestConfigurationIDFormatter(t *testing.T) { - actual := NewConfigurationID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "config1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/configurations/config1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestConfigurationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ConfigurationId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/configurations/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/configurations/config1", - Expected: &ConfigurationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ServerName: "server1", - Name: "config1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/CONFIGURATIONS/CONFIG1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ConfigurationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ServerName != v.Expected.ServerName { - t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index 92b98d991b88..469ecf093d61 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -4,7 +4,6 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/administrators/activeDirectory -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Configuration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/configurations/config1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Database -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/database1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/firewallRule1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1 diff --git a/internal/services/mysql/validate/configuration_id.go b/internal/services/mysql/validate/configuration_id.go deleted file mode 100644 index 9efc68aeed00..000000000000 --- a/internal/services/mysql/validate/configuration_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" -) - -func ConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/mysql/validate/configuration_id_test.go b/internal/services/mysql/validate/configuration_id_test.go deleted file mode 100644 index 520cdd60b0a9..000000000000 --- a/internal/services/mysql/validate/configuration_id_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestConfigurationID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Valid: false, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/configurations/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/configurations/config1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/CONFIGURATIONS/CONFIG1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ConfigurationID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/README.md new file mode 100644 index 000000000000..10f7094d8d5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability` Documentation + +The `checknameavailability` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability" +``` + + +### Client Initialization + +```go +client := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CheckNameAvailabilityClient.Execute` + +```go +ctx := context.TODO() +id := checknameavailability.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := checknameavailability.NameAvailabilityRequest{ + // ... +} + + +read, err := client.Execute(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/client.go new file mode 100644 index 000000000000..9991e58a5184 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/client.go @@ -0,0 +1,26 @@ +package checknameavailability + +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 CheckNameAvailabilityClient struct { + Client *resourcemanager.Client +} + +func NewCheckNameAvailabilityClientWithBaseURI(sdkApi sdkEnv.Api) (*CheckNameAvailabilityClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "checknameavailability", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) + } + + return &CheckNameAvailabilityClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/method_execute.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/method_execute.go new file mode 100644 index 000000000000..8b1cd1755b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/method_execute.go @@ -0,0 +1,57 @@ +package checknameavailability + +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 ExecuteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NameAvailability +} + +// Execute ... +func (c CheckNameAvailabilityClient) Execute(ctx context.Context, id commonids.SubscriptionId, input NameAvailabilityRequest) (result ExecuteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.DBforMySQL/checkNameAvailability", 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/mysql/2017-12-01/checknameavailability/model_nameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailability.go new file mode 100644 index 000000000000..b48df8acf2a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailability.go @@ -0,0 +1,10 @@ +package checknameavailability + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailability struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailabilityrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailabilityrequest.go new file mode 100644 index 000000000000..f914b6149b34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/model_nameavailabilityrequest.go @@ -0,0 +1,9 @@ +package checknameavailability + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailabilityRequest struct { + Name string `json:"name"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/version.go new file mode 100644 index 000000000000..b5b0e22c13cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability/version.go @@ -0,0 +1,12 @@ +package checknameavailability + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/checknameavailability/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/client.go new file mode 100644 index 000000000000..f745c72ad186 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/client.go @@ -0,0 +1,154 @@ +package v2017_12_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + CheckNameAvailability *checknameavailability.CheckNameAvailabilityClient + Configurations *configurations.ConfigurationsClient + ConfigurationsUpdate *configurationsupdate.ConfigurationsUpdateClient + Databases *databases.DatabasesClient + FirewallRules *firewallrules.FirewallRulesClient + LocationBasedPerformanceTier *locationbasedperformancetier.LocationBasedPerformanceTierClient + LogFiles *logfiles.LogFilesClient + RecoverableServers *recoverableservers.RecoverableServersClient + Replicas *replicas.ReplicasClient + ServerAdministrators *serveradministrators.ServerAdministratorsClient + ServerBasedPerformanceTier *serverbasedperformancetier.ServerBasedPerformanceTierClient + ServerRestart *serverrestart.ServerRestartClient + ServerSecurityAlertPolicies *serversecurityalertpolicies.ServerSecurityAlertPoliciesClient + Servers *servers.ServersClient + VirtualNetworkRules *virtualnetworkrules.VirtualNetworkRulesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) + } + configureFunc(checkNameAvailabilityClient.Client) + + configurationsClient, err := configurations.NewConfigurationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Configurations client: %+v", err) + } + configureFunc(configurationsClient.Client) + + configurationsUpdateClient, err := configurationsupdate.NewConfigurationsUpdateClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ConfigurationsUpdate client: %+v", err) + } + configureFunc(configurationsUpdateClient.Client) + + databasesClient, err := databases.NewDatabasesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Databases client: %+v", err) + } + configureFunc(databasesClient.Client) + + firewallRulesClient, err := firewallrules.NewFirewallRulesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building FirewallRules client: %+v", err) + } + configureFunc(firewallRulesClient.Client) + + locationBasedPerformanceTierClient, err := locationbasedperformancetier.NewLocationBasedPerformanceTierClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building LocationBasedPerformanceTier client: %+v", err) + } + configureFunc(locationBasedPerformanceTierClient.Client) + + logFilesClient, err := logfiles.NewLogFilesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building LogFiles client: %+v", err) + } + configureFunc(logFilesClient.Client) + + recoverableServersClient, err := recoverableservers.NewRecoverableServersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RecoverableServers client: %+v", err) + } + configureFunc(recoverableServersClient.Client) + + replicasClient, err := replicas.NewReplicasClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Replicas client: %+v", err) + } + configureFunc(replicasClient.Client) + + serverAdministratorsClient, err := serveradministrators.NewServerAdministratorsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerAdministrators client: %+v", err) + } + configureFunc(serverAdministratorsClient.Client) + + serverBasedPerformanceTierClient, err := serverbasedperformancetier.NewServerBasedPerformanceTierClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerBasedPerformanceTier client: %+v", err) + } + configureFunc(serverBasedPerformanceTierClient.Client) + + serverRestartClient, err := serverrestart.NewServerRestartClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerRestart client: %+v", err) + } + configureFunc(serverRestartClient.Client) + + serverSecurityAlertPoliciesClient, err := serversecurityalertpolicies.NewServerSecurityAlertPoliciesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerSecurityAlertPolicies client: %+v", err) + } + configureFunc(serverSecurityAlertPoliciesClient.Client) + + serversClient, err := servers.NewServersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Servers client: %+v", err) + } + configureFunc(serversClient.Client) + + virtualNetworkRulesClient, err := virtualnetworkrules.NewVirtualNetworkRulesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualNetworkRules client: %+v", err) + } + configureFunc(virtualNetworkRulesClient.Client) + + return &Client{ + CheckNameAvailability: checkNameAvailabilityClient, + Configurations: configurationsClient, + ConfigurationsUpdate: configurationsUpdateClient, + Databases: databasesClient, + FirewallRules: firewallRulesClient, + LocationBasedPerformanceTier: locationBasedPerformanceTierClient, + LogFiles: logFilesClient, + RecoverableServers: recoverableServersClient, + Replicas: replicasClient, + ServerAdministrators: serverAdministratorsClient, + ServerBasedPerformanceTier: serverBasedPerformanceTierClient, + ServerRestart: serverRestartClient, + ServerSecurityAlertPolicies: serverSecurityAlertPoliciesClient, + Servers: serversClient, + VirtualNetworkRules: virtualNetworkRulesClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/README.md new file mode 100644 index 000000000000..58bd22a2f31a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/README.md @@ -0,0 +1,69 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations` Documentation + +The `configurations` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations" +``` + + +### Client Initialization + +```go +client := configurations.NewConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +payload := configurations.Configuration{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationsClient.ListByServer` + +```go +ctx := context.TODO() +id := configurations.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/client.go new file mode 100644 index 000000000000..3ced22d176bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/client.go @@ -0,0 +1,26 @@ +package configurations + +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 ConfigurationsClient struct { + Client *resourcemanager.Client +} + +func NewConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*ConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "configurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) + } + + return &ConfigurationsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_configuration.go new file mode 100644 index 000000000000..7feaec230250 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_configuration.go @@ -0,0 +1,140 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ConfigurationId{} + +// ConfigurationId is a struct representing the Resource ID for a Configuration +type ConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + ConfigurationName string +} + +// NewConfigurationID returns a new ConfigurationId struct +func NewConfigurationID(subscriptionId string, resourceGroupName string, serverName string, configurationName string) ConfigurationId { + return ConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + ConfigurationName: configurationName, + } +} + +// ParseConfigurationID parses 'input' into a ConfigurationId +func ParseConfigurationID(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + } + + return &id, nil +} + +// ParseConfigurationIDInsensitively parses 'input' case-insensitively into a ConfigurationId +// note: this method should only be used for API response data and not user input +func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + } + + return &id, nil +} + +// ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID +func ValidateConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration ID +func (id ConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/configurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration ID +func (id ConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticConfigurations", "configurations", "configurations"), + resourceids.UserSpecifiedSegment("configurationName", "configurationValue"), + } +} + +// String returns a human-readable description of this Configuration ID +func (id ConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Configuration Name: %q", id.ConfigurationName), + } + return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_server.go new file mode 100644 index 000000000000..bae6e89be791 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/id_server.go @@ -0,0 +1,127 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_createorupdate.go new file mode 100644 index 000000000000..56e5056d1406 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_createorupdate.go @@ -0,0 +1,74 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ConfigurationsClient) CreateOrUpdate(ctx context.Context, id ConfigurationId, input Configuration) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id ConfigurationId, input Configuration) 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/mysql/2017-12-01/configurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_get.go new file mode 100644 index 000000000000..026bce8d81de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_get.go @@ -0,0 +1,51 @@ +package configurations + +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 *Configuration +} + +// Get ... +func (c ConfigurationsClient) Get(ctx context.Context, id ConfigurationId) (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/mysql/2017-12-01/configurations/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_listbyserver.go new file mode 100644 index 000000000000..1af962f2f485 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/method_listbyserver.go @@ -0,0 +1,52 @@ +package configurations + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationListResult +} + +// ListByServer ... +func (c ConfigurationsClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/configurations", 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/mysql/2017-12-01/configurations/model_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configuration.go new file mode 100644 index 000000000000..84bf2c281276 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configuration.go @@ -0,0 +1,11 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationlistresult.go new file mode 100644 index 000000000000..98af12f5801e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationlistresult.go @@ -0,0 +1,8 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationListResult struct { + Value *[]Configuration `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationproperties.go new file mode 100644 index 000000000000..51143bf6154a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/model_configurationproperties.go @@ -0,0 +1,13 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationProperties struct { + AllowedValues *string `json:"allowedValues,omitempty"` + DataType *string `json:"dataType,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + Description *string `json:"description,omitempty"` + Source *string `json:"source,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/version.go new file mode 100644 index 000000000000..14506a04060b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations/version.go @@ -0,0 +1,12 @@ +package configurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/README.md new file mode 100644 index 000000000000..6f508ae08b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate` Documentation + +The `configurationsupdate` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate" +``` + + +### Client Initialization + +```go +client := configurationsupdate.NewConfigurationsUpdateClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationsUpdateClient.ServerParametersListUpdateConfigurations` + +```go +ctx := context.TODO() +id := configurationsupdate.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := configurationsupdate.ConfigurationListResult{ + // ... +} + + +if err := client.ServerParametersListUpdateConfigurationsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/client.go new file mode 100644 index 000000000000..6e2a965b0d00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/client.go @@ -0,0 +1,26 @@ +package configurationsupdate + +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 ConfigurationsUpdateClient struct { + Client *resourcemanager.Client +} + +func NewConfigurationsUpdateClientWithBaseURI(sdkApi sdkEnv.Api) (*ConfigurationsUpdateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "configurationsupdate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ConfigurationsUpdateClient: %+v", err) + } + + return &ConfigurationsUpdateClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go new file mode 100644 index 000000000000..bdb29836fd59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go @@ -0,0 +1,127 @@ +package configurationsupdate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/method_serverparameterslistupdateconfigurations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/method_serverparameterslistupdateconfigurations.go new file mode 100644 index 000000000000..714a50faf049 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/method_serverparameterslistupdateconfigurations.go @@ -0,0 +1,74 @@ +package configurationsupdate + +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 ServerParametersListUpdateConfigurationsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServerParametersListUpdateConfigurations ... +func (c ConfigurationsUpdateClient) ServerParametersListUpdateConfigurations(ctx context.Context, id ServerId, input ConfigurationListResult) (result ServerParametersListUpdateConfigurationsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/updateConfigurations", 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 +} + +// ServerParametersListUpdateConfigurationsThenPoll performs ServerParametersListUpdateConfigurations then polls until it's completed +func (c ConfigurationsUpdateClient) ServerParametersListUpdateConfigurationsThenPoll(ctx context.Context, id ServerId, input ConfigurationListResult) error { + result, err := c.ServerParametersListUpdateConfigurations(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServerParametersListUpdateConfigurations: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServerParametersListUpdateConfigurations: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configuration.go new file mode 100644 index 000000000000..778be4143612 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configuration.go @@ -0,0 +1,11 @@ +package configurationsupdate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationlistresult.go new file mode 100644 index 000000000000..43d4610deac0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationlistresult.go @@ -0,0 +1,8 @@ +package configurationsupdate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationListResult struct { + Value *[]Configuration `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationproperties.go new file mode 100644 index 000000000000..f5f5b745af9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/model_configurationproperties.go @@ -0,0 +1,13 @@ +package configurationsupdate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationProperties struct { + AllowedValues *string `json:"allowedValues,omitempty"` + DataType *string `json:"dataType,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + Description *string `json:"description,omitempty"` + Source *string `json:"source,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/version.go new file mode 100644 index 000000000000..34a6f364482a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate/version.go @@ -0,0 +1,12 @@ +package configurationsupdate + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurationsupdate/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/README.md new file mode 100644 index 000000000000..4a9152a30672 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListByServer` + +```go +ctx := context.TODO() +id := databases.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/client.go new file mode 100644 index 000000000000..11c4bb68fa0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/client.go @@ -0,0 +1,26 @@ +package databases + +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 DatabasesClient struct { + Client *resourcemanager.Client +} + +func NewDatabasesClientWithBaseURI(sdkApi sdkEnv.Api) (*DatabasesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "databases", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) + } + + return &DatabasesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_database.go new file mode 100644 index 000000000000..a979b0a51f84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_database.go @@ -0,0 +1,140 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, serverName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_server.go new file mode 100644 index 000000000000..2b5b57fedaec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/id_server.go @@ -0,0 +1,127 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_createorupdate.go new file mode 100644 index 000000000000..9c7dbd62ad37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_createorupdate.go @@ -0,0 +1,75 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c DatabasesClient) CreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 DatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabaseId, input Database) 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/mysql/2017-12-01/databases/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_delete.go new file mode 100644 index 000000000000..dc03e5266110 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_delete.go @@ -0,0 +1,71 @@ +package databases + +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 DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) 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/mysql/2017-12-01/databases/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_get.go new file mode 100644 index 000000000000..c250e2385132 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_get.go @@ -0,0 +1,51 @@ +package databases + +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 *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (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/mysql/2017-12-01/databases/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_listbyserver.go new file mode 100644 index 000000000000..f787c7a7be36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/method_listbyserver.go @@ -0,0 +1,52 @@ +package databases + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DatabaseListResult +} + +// ListByServer ... +func (c DatabasesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/databases", 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/mysql/2017-12-01/databases/model_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_database.go new file mode 100644 index 000000000000..a9880a7432bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_database.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaselistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaselistresult.go new file mode 100644 index 000000000000..80645ead0923 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaselistresult.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseListResult struct { + Value *[]Database `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaseproperties.go new file mode 100644 index 000000000000..85fcbd70d578 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/model_databaseproperties.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseProperties struct { + Charset *string `json:"charset,omitempty"` + Collation *string `json:"collation,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/version.go new file mode 100644 index 000000000000..8d6c0a801d36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/README.md new file mode 100644 index 000000000000..5170fe481494 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules` Documentation + +The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules" +``` + + +### Client Initialization + +```go +client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FirewallRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +payload := firewallrules.FirewallRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Delete` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Get` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := firewallrules.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/client.go new file mode 100644 index 000000000000..ca183214bd2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/client.go @@ -0,0 +1,26 @@ +package firewallrules + +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 FirewallRulesClient struct { + Client *resourcemanager.Client +} + +func NewFirewallRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*FirewallRulesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "firewallrules", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) + } + + return &FirewallRulesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go new file mode 100644 index 000000000000..44ddf9c5e098 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go @@ -0,0 +1,140 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, serverName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_server.go new file mode 100644 index 000000000000..e17ef27d1406 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/id_server.go @@ -0,0 +1,127 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_createorupdate.go new file mode 100644 index 000000000000..662f89e92777 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_createorupdate.go @@ -0,0 +1,75 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c FirewallRulesClient) CreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 FirewallRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id FirewallRuleId, input FirewallRule) 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/mysql/2017-12-01/firewallrules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_delete.go new file mode 100644 index 000000000000..44b95e975c0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_delete.go @@ -0,0 +1,71 @@ +package firewallrules + +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 FirewallRulesClient) Delete(ctx context.Context, id FirewallRuleId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FirewallRulesClient) DeleteThenPoll(ctx context.Context, id FirewallRuleId) 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/mysql/2017-12-01/firewallrules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_get.go new file mode 100644 index 000000000000..7a57e1e3b1f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_get.go @@ -0,0 +1,51 @@ +package firewallrules + +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 *FirewallRule +} + +// Get ... +func (c FirewallRulesClient) Get(ctx context.Context, id FirewallRuleId) (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/mysql/2017-12-01/firewallrules/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_listbyserver.go new file mode 100644 index 000000000000..62558e790243 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/method_listbyserver.go @@ -0,0 +1,52 @@ +package firewallrules + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FirewallRuleListResult +} + +// ListByServer ... +func (c FirewallRulesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/firewallRules", 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/mysql/2017-12-01/firewallrules/model_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrule.go new file mode 100644 index 000000000000..3178a13ed2c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrule.go @@ -0,0 +1,11 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties FirewallRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrulelistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrulelistresult.go new file mode 100644 index 000000000000..c01e91fae564 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallrulelistresult.go @@ -0,0 +1,8 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleListResult struct { + Value *[]FirewallRule `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallruleproperties.go new file mode 100644 index 000000000000..fca4e1c3684b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/model_firewallruleproperties.go @@ -0,0 +1,9 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleProperties struct { + EndIPAddress string `json:"endIpAddress"` + StartIPAddress string `json:"startIpAddress"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/version.go new file mode 100644 index 000000000000..38c1ba53b63a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules/version.go @@ -0,0 +1,12 @@ +package firewallrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/firewallrules/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/README.md new file mode 100644 index 000000000000..3c7429023ff2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier` Documentation + +The `locationbasedperformancetier` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier" +``` + + +### Client Initialization + +```go +client := locationbasedperformancetier.NewLocationBasedPerformanceTierClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LocationBasedPerformanceTierClient.List` + +```go +ctx := context.TODO() +id := locationbasedperformancetier.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/client.go new file mode 100644 index 000000000000..846c4a938470 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/client.go @@ -0,0 +1,26 @@ +package locationbasedperformancetier + +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 LocationBasedPerformanceTierClient struct { + Client *resourcemanager.Client +} + +func NewLocationBasedPerformanceTierClientWithBaseURI(sdkApi sdkEnv.Api) (*LocationBasedPerformanceTierClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "locationbasedperformancetier", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LocationBasedPerformanceTierClient: %+v", err) + } + + return &LocationBasedPerformanceTierClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go new file mode 100644 index 000000000000..8153c2241ff3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go @@ -0,0 +1,114 @@ +package locationbasedperformancetier + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.DBforMySQL/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/method_list.go new file mode 100644 index 000000000000..66c6f1fb83bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/method_list.go @@ -0,0 +1,52 @@ +package locationbasedperformancetier + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PerformanceTierListResult +} + +// List ... +func (c LocationBasedPerformanceTierClient) List(ctx context.Context, id LocationId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/performanceTiers", 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/mysql/2017-12-01/locationbasedperformancetier/model_performancetierlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierlistresult.go new file mode 100644 index 000000000000..efb02a3f4b3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierlistresult.go @@ -0,0 +1,8 @@ +package locationbasedperformancetier + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerformanceTierListResult struct { + Value *[]PerformanceTierProperties `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierproperties.go new file mode 100644 index 000000000000..4d8824192636 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierproperties.go @@ -0,0 +1,15 @@ +package locationbasedperformancetier + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerformanceTierProperties struct { + Id *string `json:"id,omitempty"` + MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"` + MaxLargeStorageMB *int64 `json:"maxLargeStorageMB,omitempty"` + MaxStorageMB *int64 `json:"maxStorageMB,omitempty"` + MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"` + MinLargeStorageMB *int64 `json:"minLargeStorageMB,omitempty"` + MinStorageMB *int64 `json:"minStorageMB,omitempty"` + ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierservicelevelobjectives.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierservicelevelobjectives.go new file mode 100644 index 000000000000..1945dc2855a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/model_performancetierservicelevelobjectives.go @@ -0,0 +1,15 @@ +package locationbasedperformancetier + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerformanceTierServiceLevelObjectives struct { + Edition *string `json:"edition,omitempty"` + HardwareGeneration *string `json:"hardwareGeneration,omitempty"` + Id *string `json:"id,omitempty"` + MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"` + MaxStorageMB *int64 `json:"maxStorageMB,omitempty"` + MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"` + MinStorageMB *int64 `json:"minStorageMB,omitempty"` + VCore *int64 `json:"vCore,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/version.go new file mode 100644 index 000000000000..c8c4af354290 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier/version.go @@ -0,0 +1,12 @@ +package locationbasedperformancetier + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/locationbasedperformancetier/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/README.md new file mode 100644 index 000000000000..90247c24ab18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles` Documentation + +The `logfiles` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles" +``` + + +### Client Initialization + +```go +client := logfiles.NewLogFilesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LogFilesClient.ListByServer` + +```go +ctx := context.TODO() +id := logfiles.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/client.go new file mode 100644 index 000000000000..8e5eb3275286 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/client.go @@ -0,0 +1,26 @@ +package logfiles + +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 LogFilesClient struct { + Client *resourcemanager.Client +} + +func NewLogFilesClientWithBaseURI(sdkApi sdkEnv.Api) (*LogFilesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "logfiles", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LogFilesClient: %+v", err) + } + + return &LogFilesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/id_server.go new file mode 100644 index 000000000000..d1d651dd73e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/id_server.go @@ -0,0 +1,127 @@ +package logfiles + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/method_listbyserver.go new file mode 100644 index 000000000000..30f2a92ac454 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/method_listbyserver.go @@ -0,0 +1,52 @@ +package logfiles + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LogFileListResult +} + +// ListByServer ... +func (c LogFilesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/logFiles", 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/mysql/2017-12-01/logfiles/model_logfile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfile.go new file mode 100644 index 000000000000..6c0a4bd8cd84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfile.go @@ -0,0 +1,11 @@ +package logfiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogFile struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *LogFileProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfilelistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfilelistresult.go new file mode 100644 index 000000000000..c38e3fd8cb5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfilelistresult.go @@ -0,0 +1,8 @@ +package logfiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogFileListResult struct { + Value *[]LogFile `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfileproperties.go new file mode 100644 index 000000000000..43030a1fdc1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/model_logfileproperties.go @@ -0,0 +1,42 @@ +package logfiles + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogFileProperties struct { + CreatedTime *string `json:"createdTime,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + SizeInKB *int64 `json:"sizeInKB,omitempty"` + Type *string `json:"type,omitempty"` + Url *string `json:"url,omitempty"` +} + +func (o *LogFileProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogFileProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} + +func (o *LogFileProperties) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogFileProperties) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/version.go new file mode 100644 index 000000000000..27dfc7d12ca8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles/version.go @@ -0,0 +1,12 @@ +package logfiles + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/logfiles/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/README.md new file mode 100644 index 000000000000..218550a80762 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers` Documentation + +The `recoverableservers` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers" +``` + + +### Client Initialization + +```go +client := recoverableservers.NewRecoverableServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RecoverableServersClient.Get` + +```go +ctx := context.TODO() +id := recoverableservers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/client.go new file mode 100644 index 000000000000..f1d53f031194 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/client.go @@ -0,0 +1,26 @@ +package recoverableservers + +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 RecoverableServersClient struct { + Client *resourcemanager.Client +} + +func NewRecoverableServersClientWithBaseURI(sdkApi sdkEnv.Api) (*RecoverableServersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "recoverableservers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RecoverableServersClient: %+v", err) + } + + return &RecoverableServersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go new file mode 100644 index 000000000000..b6c50db61a1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go @@ -0,0 +1,127 @@ +package recoverableservers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/method_get.go new file mode 100644 index 000000000000..c50065e8c944 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/method_get.go @@ -0,0 +1,52 @@ +package recoverableservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecoverableServerResource +} + +// Get ... +func (c RecoverableServersClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recoverableServers", 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/mysql/2017-12-01/recoverableservers/model_recoverableserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverproperties.go new file mode 100644 index 000000000000..7defed3639c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverproperties.go @@ -0,0 +1,13 @@ +package recoverableservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecoverableServerProperties struct { + Edition *string `json:"edition,omitempty"` + HardwareGeneration *string `json:"hardwareGeneration,omitempty"` + LastAvailableBackupDateTime *string `json:"lastAvailableBackupDateTime,omitempty"` + ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` + VCore *int64 `json:"vCore,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverresource.go new file mode 100644 index 000000000000..7e4d6edf7e66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/model_recoverableserverresource.go @@ -0,0 +1,11 @@ +package recoverableservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecoverableServerResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RecoverableServerProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/version.go new file mode 100644 index 000000000000..83ae9b19beb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers/version.go @@ -0,0 +1,12 @@ +package recoverableservers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/recoverableservers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/README.md new file mode 100644 index 000000000000..07352b5a8cb6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas` Documentation + +The `replicas` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas" +``` + + +### Client Initialization + +```go +client := replicas.NewReplicasClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ReplicasClient.ListByServer` + +```go +ctx := context.TODO() +id := replicas.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/client.go new file mode 100644 index 000000000000..d971742c1bdc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/client.go @@ -0,0 +1,26 @@ +package replicas + +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 ReplicasClient struct { + Client *resourcemanager.Client +} + +func NewReplicasClientWithBaseURI(sdkApi sdkEnv.Api) (*ReplicasClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "replicas", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ReplicasClient: %+v", err) + } + + return &ReplicasClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/constants.go new file mode 100644 index 000000000000..5faba94d75ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/constants.go @@ -0,0 +1,532 @@ +package replicas + +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. + +type GeoRedundantBackup string + +const ( + GeoRedundantBackupDisabled GeoRedundantBackup = "Disabled" + GeoRedundantBackupEnabled GeoRedundantBackup = "Enabled" +) + +func PossibleValuesForGeoRedundantBackup() []string { + return []string{ + string(GeoRedundantBackupDisabled), + string(GeoRedundantBackupEnabled), + } +} + +func (s *GeoRedundantBackup) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGeoRedundantBackup(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGeoRedundantBackup(input string) (*GeoRedundantBackup, error) { + vals := map[string]GeoRedundantBackup{ + "disabled": GeoRedundantBackupDisabled, + "enabled": GeoRedundantBackupEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackup(input) + return &out, nil +} + +type InfrastructureEncryption string + +const ( + InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" + InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" +) + +func PossibleValuesForInfrastructureEncryption() []string { + return []string{ + string(InfrastructureEncryptionDisabled), + string(InfrastructureEncryptionEnabled), + } +} + +func (s *InfrastructureEncryption) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInfrastructureEncryption(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInfrastructureEncryption(input string) (*InfrastructureEncryption, error) { + vals := map[string]InfrastructureEncryption{ + "disabled": InfrastructureEncryptionDisabled, + "enabled": InfrastructureEncryptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryption(input) + return &out, nil +} + +type MinimalTlsVersionEnum string + +const ( + MinimalTlsVersionEnumTLSEnforcementDisabled MinimalTlsVersionEnum = "TLSEnforcementDisabled" + MinimalTlsVersionEnumTLSOneOne MinimalTlsVersionEnum = "TLS1_1" + MinimalTlsVersionEnumTLSOneTwo MinimalTlsVersionEnum = "TLS1_2" + MinimalTlsVersionEnumTLSOneZero MinimalTlsVersionEnum = "TLS1_0" +) + +func PossibleValuesForMinimalTlsVersionEnum() []string { + return []string{ + string(MinimalTlsVersionEnumTLSEnforcementDisabled), + string(MinimalTlsVersionEnumTLSOneOne), + string(MinimalTlsVersionEnumTLSOneTwo), + string(MinimalTlsVersionEnumTLSOneZero), + } +} + +func (s *MinimalTlsVersionEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMinimalTlsVersionEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMinimalTlsVersionEnum(input string) (*MinimalTlsVersionEnum, error) { + vals := map[string]MinimalTlsVersionEnum{ + "tlsenforcementdisabled": MinimalTlsVersionEnumTLSEnforcementDisabled, + "tls1_1": MinimalTlsVersionEnumTLSOneOne, + "tls1_2": MinimalTlsVersionEnumTLSOneTwo, + "tls1_0": MinimalTlsVersionEnumTLSOneZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MinimalTlsVersionEnum(input) + return &out, nil +} + +type PrivateEndpointProvisioningState string + +const ( + PrivateEndpointProvisioningStateApproving PrivateEndpointProvisioningState = "Approving" + PrivateEndpointProvisioningStateDropping PrivateEndpointProvisioningState = "Dropping" + PrivateEndpointProvisioningStateFailed PrivateEndpointProvisioningState = "Failed" + PrivateEndpointProvisioningStateReady PrivateEndpointProvisioningState = "Ready" + PrivateEndpointProvisioningStateRejecting PrivateEndpointProvisioningState = "Rejecting" +) + +func PossibleValuesForPrivateEndpointProvisioningState() []string { + return []string{ + string(PrivateEndpointProvisioningStateApproving), + string(PrivateEndpointProvisioningStateDropping), + string(PrivateEndpointProvisioningStateFailed), + string(PrivateEndpointProvisioningStateReady), + string(PrivateEndpointProvisioningStateRejecting), + } +} + +func (s *PrivateEndpointProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointProvisioningState(input string) (*PrivateEndpointProvisioningState, error) { + vals := map[string]PrivateEndpointProvisioningState{ + "approving": PrivateEndpointProvisioningStateApproving, + "dropping": PrivateEndpointProvisioningStateDropping, + "failed": PrivateEndpointProvisioningStateFailed, + "ready": PrivateEndpointProvisioningStateReady, + "rejecting": PrivateEndpointProvisioningStateRejecting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateActionsRequire string + +const ( + PrivateLinkServiceConnectionStateActionsRequireNone PrivateLinkServiceConnectionStateActionsRequire = "None" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateActionsRequire() []string { + return []string{ + string(PrivateLinkServiceConnectionStateActionsRequireNone), + } +} + +func (s *PrivateLinkServiceConnectionStateActionsRequire) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStateActionsRequire(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStateActionsRequire(input string) (*PrivateLinkServiceConnectionStateActionsRequire, error) { + vals := map[string]PrivateLinkServiceConnectionStateActionsRequire{ + "none": PrivateLinkServiceConnectionStateActionsRequireNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateActionsRequire(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateStatus string + +const ( + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStateStatusApproved), + string(PrivateLinkServiceConnectionStateStatusDisconnected), + string(PrivateLinkServiceConnectionStateStatusPending), + string(PrivateLinkServiceConnectionStateStatusRejected), + } +} + +func (s *PrivateLinkServiceConnectionStateStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStateStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStateStatus(input string) (*PrivateLinkServiceConnectionStateStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStateStatus{ + "approved": PrivateLinkServiceConnectionStateStatusApproved, + "disconnected": PrivateLinkServiceConnectionStateStatusDisconnected, + "pending": PrivateLinkServiceConnectionStateStatusPending, + "rejected": PrivateLinkServiceConnectionStateStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateStatus(input) + return &out, nil +} + +type PublicNetworkAccessEnum string + +const ( + PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" + PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessEnum() []string { + return []string{ + string(PublicNetworkAccessEnumDisabled), + string(PublicNetworkAccessEnumEnabled), + } +} + +func (s *PublicNetworkAccessEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccessEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccessEnum(input string) (*PublicNetworkAccessEnum, error) { + vals := map[string]PublicNetworkAccessEnum{ + "disabled": PublicNetworkAccessEnumDisabled, + "enabled": PublicNetworkAccessEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessEnum(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateInaccessible ServerState = "Inaccessible" + ServerStateReady ServerState = "Ready" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateInaccessible), + string(ServerStateReady), + } +} + +func (s *ServerState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "inaccessible": ServerStateInaccessible, + "ready": ServerStateReady, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionEightPointZero ServerVersion = "8.0" + ServerVersionFivePointSeven ServerVersion = "5.7" + ServerVersionFivePointSix ServerVersion = "5.6" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionEightPointZero), + string(ServerVersionFivePointSeven), + string(ServerVersionFivePointSix), + } +} + +func (s *ServerVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "8.0": ServerVersionEightPointZero, + "5.7": ServerVersionFivePointSeven, + "5.6": ServerVersionFivePointSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func (s *SkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type SslEnforcementEnum string + +const ( + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +func PossibleValuesForSslEnforcementEnum() []string { + return []string{ + string(SslEnforcementEnumDisabled), + string(SslEnforcementEnumEnabled), + } +} + +func (s *SslEnforcementEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSslEnforcementEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSslEnforcementEnum(input string) (*SslEnforcementEnum, error) { + vals := map[string]SslEnforcementEnum{ + "disabled": SslEnforcementEnumDisabled, + "enabled": SslEnforcementEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnforcementEnum(input) + return &out, nil +} + +type StorageAutogrow string + +const ( + StorageAutogrowDisabled StorageAutogrow = "Disabled" + StorageAutogrowEnabled StorageAutogrow = "Enabled" +) + +func PossibleValuesForStorageAutogrow() []string { + return []string{ + string(StorageAutogrowDisabled), + string(StorageAutogrowEnabled), + } +} + +func (s *StorageAutogrow) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAutogrow(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAutogrow(input string) (*StorageAutogrow, error) { + vals := map[string]StorageAutogrow{ + "disabled": StorageAutogrowDisabled, + "enabled": StorageAutogrowEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAutogrow(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/id_server.go new file mode 100644 index 000000000000..66bf4a46371e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/id_server.go @@ -0,0 +1,127 @@ +package replicas + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/method_listbyserver.go new file mode 100644 index 000000000000..aae181ee976c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/method_listbyserver.go @@ -0,0 +1,52 @@ +package replicas + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ServerListResult +} + +// ListByServer ... +func (c ReplicasClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/replicas", 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/mysql/2017-12-01/replicas/model_privateendpointproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_privateendpointproperty.go new file mode 100644 index 000000000000..aa789c1702bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_server.go new file mode 100644 index 000000000000..16c92f066955 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_server.go @@ -0,0 +1,19 @@ +package replicas + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Server struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ServerProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverlistresult.go new file mode 100644 index 000000000000..cfe3f1082fb3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverlistresult.go @@ -0,0 +1,8 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerListResult struct { + Value *[]Server `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnection.go new file mode 100644 index 000000000000..abef1be6aea4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnection.go @@ -0,0 +1,9 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go new file mode 100644 index 000000000000..377f6aae3ac5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go new file mode 100644 index 000000000000..fb5596f395ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status PrivateLinkServiceConnectionStateStatus `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverproperties.go new file mode 100644 index 000000000000..502787a5c4b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_serverproperties.go @@ -0,0 +1,40 @@ +package replicas + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + ByokEnforcement *string `json:"byokEnforcement,omitempty"` + EarliestRestoreDate *string `json:"earliestRestoreDate,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MasterServerId *string `json:"masterServerId,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicaCapacity *int64 `json:"replicaCapacity,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + UserVisibleState *ServerState `json:"userVisibleState,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +func (o *ServerProperties) GetEarliestRestoreDateAsTime() (*time.Time, error) { + if o.EarliestRestoreDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EarliestRestoreDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerProperties) SetEarliestRestoreDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EarliestRestoreDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_sku.go new file mode 100644 index 000000000000..5d3c52561d8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_sku.go @@ -0,0 +1,12 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_storageprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_storageprofile.go new file mode 100644 index 000000000000..9ae70a2ddc7e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/model_storageprofile.go @@ -0,0 +1,11 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + BackupRetentionDays *int64 `json:"backupRetentionDays,omitempty"` + GeoRedundantBackup *GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + StorageAutogrow *StorageAutogrow `json:"storageAutogrow,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/version.go new file mode 100644 index 000000000000..127efac84861 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas/version.go @@ -0,0 +1,12 @@ +package replicas + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/replicas/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/README.md new file mode 100644 index 000000000000..57be8644faa3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators` Documentation + +The `serveradministrators` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators" +``` + + +### Client Initialization + +```go +client := serveradministrators.NewServerAdministratorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerAdministratorsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := serveradministrators.ServerAdministratorResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerAdministratorsClient.Delete` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerAdministratorsClient.Get` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServerAdministratorsClient.List` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/client.go new file mode 100644 index 000000000000..de0fa892b40c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/client.go @@ -0,0 +1,26 @@ +package serveradministrators + +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 ServerAdministratorsClient struct { + Client *resourcemanager.Client +} + +func NewServerAdministratorsClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerAdministratorsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serveradministrators", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerAdministratorsClient: %+v", err) + } + + return &ServerAdministratorsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/constants.go new file mode 100644 index 000000000000..ca8ea7f1552e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/constants.go @@ -0,0 +1,48 @@ +package serveradministrators + +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. + +type AdministratorType string + +const ( + AdministratorTypeActiveDirectory AdministratorType = "ActiveDirectory" +) + +func PossibleValuesForAdministratorType() []string { + return []string{ + string(AdministratorTypeActiveDirectory), + } +} + +func (s *AdministratorType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAdministratorType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAdministratorType(input string) (*AdministratorType, error) { + vals := map[string]AdministratorType{ + "activedirectory": AdministratorTypeActiveDirectory, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AdministratorType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go new file mode 100644 index 000000000000..e6e1ed4b264d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go @@ -0,0 +1,127 @@ +package serveradministrators + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_createorupdate.go new file mode 100644 index 000000000000..a6e8db2faa14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_createorupdate.go @@ -0,0 +1,74 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ServerAdministratorsClient) CreateOrUpdate(ctx context.Context, id ServerId, input ServerAdministratorResource) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/administrators/activeDirectory", 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 ServerAdministratorsClient) CreateOrUpdateThenPoll(ctx context.Context, id ServerId, input ServerAdministratorResource) 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/mysql/2017-12-01/serveradministrators/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_delete.go new file mode 100644 index 000000000000..d81aaf9f5d7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_delete.go @@ -0,0 +1,71 @@ +package serveradministrators + +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 ServerAdministratorsClient) Delete(ctx context.Context, id ServerId) (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: fmt.Sprintf("%s/administrators/activeDirectory", 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 ServerAdministratorsClient) DeleteThenPoll(ctx context.Context, id ServerId) 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/mysql/2017-12-01/serveradministrators/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_get.go new file mode 100644 index 000000000000..2f5355290411 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_get.go @@ -0,0 +1,52 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ServerAdministratorResource +} + +// Get ... +func (c ServerAdministratorsClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/administrators/activeDirectory", 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/mysql/2017-12-01/serveradministrators/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_list.go new file mode 100644 index 000000000000..29d89dc61821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/method_list.go @@ -0,0 +1,52 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ServerAdministratorResourceListResult +} + +// List ... +func (c ServerAdministratorsClient) List(ctx context.Context, id ServerId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/administrators", 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/mysql/2017-12-01/serveradministrators/model_serveradministratorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorproperties.go new file mode 100644 index 000000000000..581360e3ec3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorproperties.go @@ -0,0 +1,11 @@ +package serveradministrators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorProperties struct { + AdministratorType AdministratorType `json:"administratorType"` + Login string `json:"login"` + Sid string `json:"sid"` + TenantId string `json:"tenantId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresource.go new file mode 100644 index 000000000000..70bd30aafa16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresource.go @@ -0,0 +1,11 @@ +package serveradministrators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ServerAdministratorProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go new file mode 100644 index 000000000000..7219f82deba0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go @@ -0,0 +1,8 @@ +package serveradministrators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorResourceListResult struct { + Value *[]ServerAdministratorResource `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/version.go new file mode 100644 index 000000000000..c33f7aa2ba6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators/version.go @@ -0,0 +1,12 @@ +package serveradministrators + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serveradministrators/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/README.md new file mode 100644 index 000000000000..df95da54fe77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier` Documentation + +The `serverbasedperformancetier` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier" +``` + + +### Client Initialization + +```go +client := serverbasedperformancetier.NewServerBasedPerformanceTierClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerBasedPerformanceTierClient.List` + +```go +ctx := context.TODO() +id := serverbasedperformancetier.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/client.go new file mode 100644 index 000000000000..f4cfb845cfc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/client.go @@ -0,0 +1,26 @@ +package serverbasedperformancetier + +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 ServerBasedPerformanceTierClient struct { + Client *resourcemanager.Client +} + +func NewServerBasedPerformanceTierClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerBasedPerformanceTierClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serverbasedperformancetier", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerBasedPerformanceTierClient: %+v", err) + } + + return &ServerBasedPerformanceTierClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go new file mode 100644 index 000000000000..7e4d55fd016c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go @@ -0,0 +1,127 @@ +package serverbasedperformancetier + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/method_list.go new file mode 100644 index 000000000000..bcf6a9d99faf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/method_list.go @@ -0,0 +1,52 @@ +package serverbasedperformancetier + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PerformanceTierListResult +} + +// List ... +func (c ServerBasedPerformanceTierClient) List(ctx context.Context, id ServerId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/performanceTiers", 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/mysql/2017-12-01/serverbasedperformancetier/model_performancetierlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierlistresult.go new file mode 100644 index 000000000000..52653a9804d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierlistresult.go @@ -0,0 +1,8 @@ +package serverbasedperformancetier + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerformanceTierListResult struct { + Value *[]PerformanceTierProperties `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierproperties.go new file mode 100644 index 000000000000..1b88a625eceb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierproperties.go @@ -0,0 +1,15 @@ +package serverbasedperformancetier + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerformanceTierProperties struct { + Id *string `json:"id,omitempty"` + MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"` + MaxLargeStorageMB *int64 `json:"maxLargeStorageMB,omitempty"` + MaxStorageMB *int64 `json:"maxStorageMB,omitempty"` + MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"` + MinLargeStorageMB *int64 `json:"minLargeStorageMB,omitempty"` + MinStorageMB *int64 `json:"minStorageMB,omitempty"` + ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierservicelevelobjectives.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierservicelevelobjectives.go new file mode 100644 index 000000000000..af5405441f06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/model_performancetierservicelevelobjectives.go @@ -0,0 +1,15 @@ +package serverbasedperformancetier + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerformanceTierServiceLevelObjectives struct { + Edition *string `json:"edition,omitempty"` + HardwareGeneration *string `json:"hardwareGeneration,omitempty"` + Id *string `json:"id,omitempty"` + MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"` + MaxStorageMB *int64 `json:"maxStorageMB,omitempty"` + MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"` + MinStorageMB *int64 `json:"minStorageMB,omitempty"` + VCore *int64 `json:"vCore,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/version.go new file mode 100644 index 000000000000..9f0f6bffe081 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier/version.go @@ -0,0 +1,12 @@ +package serverbasedperformancetier + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverbasedperformancetier/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/client.go new file mode 100644 index 000000000000..0a08b2a68205 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/client.go @@ -0,0 +1,26 @@ +package serverrestart + +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 ServerRestartClient struct { + Client *resourcemanager.Client +} + +func NewServerRestartClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerRestartClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serverrestart", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerRestartClient: %+v", err) + } + + return &ServerRestartClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/id_server.go new file mode 100644 index 000000000000..c5975a59e6c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/id_server.go @@ -0,0 +1,127 @@ +package serverrestart + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/method_serversrestart.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/method_serversrestart.go new file mode 100644 index 000000000000..9898c59de54f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/method_serversrestart.go @@ -0,0 +1,70 @@ +package serverrestart + +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 ServersRestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServersRestart ... +func (c ServerRestartClient) ServersRestart(ctx context.Context, id ServerId) (result ServersRestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// ServersRestartThenPoll performs ServersRestart then polls until it's completed +func (c ServerRestartClient) ServersRestartThenPoll(ctx context.Context, id ServerId) error { + result, err := c.ServersRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing ServersRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServersRestart: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/version.go new file mode 100644 index 000000000000..80fdf66e1aa6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart/version.go @@ -0,0 +1,12 @@ +package serverrestart + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverrestart/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/README.md new file mode 100644 index 000000000000..197f44d17eaf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/README.md @@ -0,0 +1,114 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers` Documentation + +The `servers` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" +``` + + +### Client Initialization + +```go +client := servers.NewServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServersClient.Create` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerForCreate{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Delete` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Get` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.List` + +```go +ctx := context.TODO() +id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.Update` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/client.go new file mode 100644 index 000000000000..64c1b8daeb31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/client.go @@ -0,0 +1,26 @@ +package servers + +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 ServersClient struct { + Client *resourcemanager.Client +} + +func NewServersClientWithBaseURI(sdkApi sdkEnv.Api) (*ServersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "servers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServersClient: %+v", err) + } + + return &ServersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/constants.go new file mode 100644 index 000000000000..924c751a78d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/constants.go @@ -0,0 +1,579 @@ +package servers + +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. + +type CreateMode string + +const ( + CreateModeDefault CreateMode = "Default" + CreateModeGeoRestore CreateMode = "GeoRestore" + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + CreateModeReplica CreateMode = "Replica" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeDefault), + string(CreateModeGeoRestore), + string(CreateModePointInTimeRestore), + string(CreateModeReplica), + } +} + +func (s *CreateMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCreateMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "default": CreateModeDefault, + "georestore": CreateModeGeoRestore, + "pointintimerestore": CreateModePointInTimeRestore, + "replica": CreateModeReplica, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type GeoRedundantBackup string + +const ( + GeoRedundantBackupDisabled GeoRedundantBackup = "Disabled" + GeoRedundantBackupEnabled GeoRedundantBackup = "Enabled" +) + +func PossibleValuesForGeoRedundantBackup() []string { + return []string{ + string(GeoRedundantBackupDisabled), + string(GeoRedundantBackupEnabled), + } +} + +func (s *GeoRedundantBackup) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGeoRedundantBackup(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGeoRedundantBackup(input string) (*GeoRedundantBackup, error) { + vals := map[string]GeoRedundantBackup{ + "disabled": GeoRedundantBackupDisabled, + "enabled": GeoRedundantBackupEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackup(input) + return &out, nil +} + +type InfrastructureEncryption string + +const ( + InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" + InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" +) + +func PossibleValuesForInfrastructureEncryption() []string { + return []string{ + string(InfrastructureEncryptionDisabled), + string(InfrastructureEncryptionEnabled), + } +} + +func (s *InfrastructureEncryption) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInfrastructureEncryption(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInfrastructureEncryption(input string) (*InfrastructureEncryption, error) { + vals := map[string]InfrastructureEncryption{ + "disabled": InfrastructureEncryptionDisabled, + "enabled": InfrastructureEncryptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryption(input) + return &out, nil +} + +type MinimalTlsVersionEnum string + +const ( + MinimalTlsVersionEnumTLSEnforcementDisabled MinimalTlsVersionEnum = "TLSEnforcementDisabled" + MinimalTlsVersionEnumTLSOneOne MinimalTlsVersionEnum = "TLS1_1" + MinimalTlsVersionEnumTLSOneTwo MinimalTlsVersionEnum = "TLS1_2" + MinimalTlsVersionEnumTLSOneZero MinimalTlsVersionEnum = "TLS1_0" +) + +func PossibleValuesForMinimalTlsVersionEnum() []string { + return []string{ + string(MinimalTlsVersionEnumTLSEnforcementDisabled), + string(MinimalTlsVersionEnumTLSOneOne), + string(MinimalTlsVersionEnumTLSOneTwo), + string(MinimalTlsVersionEnumTLSOneZero), + } +} + +func (s *MinimalTlsVersionEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMinimalTlsVersionEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMinimalTlsVersionEnum(input string) (*MinimalTlsVersionEnum, error) { + vals := map[string]MinimalTlsVersionEnum{ + "tlsenforcementdisabled": MinimalTlsVersionEnumTLSEnforcementDisabled, + "tls1_1": MinimalTlsVersionEnumTLSOneOne, + "tls1_2": MinimalTlsVersionEnumTLSOneTwo, + "tls1_0": MinimalTlsVersionEnumTLSOneZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MinimalTlsVersionEnum(input) + return &out, nil +} + +type PrivateEndpointProvisioningState string + +const ( + PrivateEndpointProvisioningStateApproving PrivateEndpointProvisioningState = "Approving" + PrivateEndpointProvisioningStateDropping PrivateEndpointProvisioningState = "Dropping" + PrivateEndpointProvisioningStateFailed PrivateEndpointProvisioningState = "Failed" + PrivateEndpointProvisioningStateReady PrivateEndpointProvisioningState = "Ready" + PrivateEndpointProvisioningStateRejecting PrivateEndpointProvisioningState = "Rejecting" +) + +func PossibleValuesForPrivateEndpointProvisioningState() []string { + return []string{ + string(PrivateEndpointProvisioningStateApproving), + string(PrivateEndpointProvisioningStateDropping), + string(PrivateEndpointProvisioningStateFailed), + string(PrivateEndpointProvisioningStateReady), + string(PrivateEndpointProvisioningStateRejecting), + } +} + +func (s *PrivateEndpointProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointProvisioningState(input string) (*PrivateEndpointProvisioningState, error) { + vals := map[string]PrivateEndpointProvisioningState{ + "approving": PrivateEndpointProvisioningStateApproving, + "dropping": PrivateEndpointProvisioningStateDropping, + "failed": PrivateEndpointProvisioningStateFailed, + "ready": PrivateEndpointProvisioningStateReady, + "rejecting": PrivateEndpointProvisioningStateRejecting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateActionsRequire string + +const ( + PrivateLinkServiceConnectionStateActionsRequireNone PrivateLinkServiceConnectionStateActionsRequire = "None" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateActionsRequire() []string { + return []string{ + string(PrivateLinkServiceConnectionStateActionsRequireNone), + } +} + +func (s *PrivateLinkServiceConnectionStateActionsRequire) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStateActionsRequire(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStateActionsRequire(input string) (*PrivateLinkServiceConnectionStateActionsRequire, error) { + vals := map[string]PrivateLinkServiceConnectionStateActionsRequire{ + "none": PrivateLinkServiceConnectionStateActionsRequireNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateActionsRequire(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateStatus string + +const ( + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStateStatusApproved), + string(PrivateLinkServiceConnectionStateStatusDisconnected), + string(PrivateLinkServiceConnectionStateStatusPending), + string(PrivateLinkServiceConnectionStateStatusRejected), + } +} + +func (s *PrivateLinkServiceConnectionStateStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStateStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStateStatus(input string) (*PrivateLinkServiceConnectionStateStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStateStatus{ + "approved": PrivateLinkServiceConnectionStateStatusApproved, + "disconnected": PrivateLinkServiceConnectionStateStatusDisconnected, + "pending": PrivateLinkServiceConnectionStateStatusPending, + "rejected": PrivateLinkServiceConnectionStateStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateStatus(input) + return &out, nil +} + +type PublicNetworkAccessEnum string + +const ( + PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" + PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessEnum() []string { + return []string{ + string(PublicNetworkAccessEnumDisabled), + string(PublicNetworkAccessEnumEnabled), + } +} + +func (s *PublicNetworkAccessEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccessEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccessEnum(input string) (*PublicNetworkAccessEnum, error) { + vals := map[string]PublicNetworkAccessEnum{ + "disabled": PublicNetworkAccessEnumDisabled, + "enabled": PublicNetworkAccessEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessEnum(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateInaccessible ServerState = "Inaccessible" + ServerStateReady ServerState = "Ready" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateInaccessible), + string(ServerStateReady), + } +} + +func (s *ServerState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "inaccessible": ServerStateInaccessible, + "ready": ServerStateReady, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionEightPointZero ServerVersion = "8.0" + ServerVersionFivePointSeven ServerVersion = "5.7" + ServerVersionFivePointSix ServerVersion = "5.6" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionEightPointZero), + string(ServerVersionFivePointSeven), + string(ServerVersionFivePointSix), + } +} + +func (s *ServerVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "8.0": ServerVersionEightPointZero, + "5.7": ServerVersionFivePointSeven, + "5.6": ServerVersionFivePointSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func (s *SkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type SslEnforcementEnum string + +const ( + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +func PossibleValuesForSslEnforcementEnum() []string { + return []string{ + string(SslEnforcementEnumDisabled), + string(SslEnforcementEnumEnabled), + } +} + +func (s *SslEnforcementEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSslEnforcementEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSslEnforcementEnum(input string) (*SslEnforcementEnum, error) { + vals := map[string]SslEnforcementEnum{ + "disabled": SslEnforcementEnumDisabled, + "enabled": SslEnforcementEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnforcementEnum(input) + return &out, nil +} + +type StorageAutogrow string + +const ( + StorageAutogrowDisabled StorageAutogrow = "Disabled" + StorageAutogrowEnabled StorageAutogrow = "Enabled" +) + +func PossibleValuesForStorageAutogrow() []string { + return []string{ + string(StorageAutogrowDisabled), + string(StorageAutogrowEnabled), + } +} + +func (s *StorageAutogrow) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAutogrow(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAutogrow(input string) (*StorageAutogrow, error) { + vals := map[string]StorageAutogrow{ + "disabled": StorageAutogrowDisabled, + "enabled": StorageAutogrowEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAutogrow(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/id_server.go new file mode 100644 index 000000000000..13b3bb2dbaa7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/id_server.go @@ -0,0 +1,127 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_create.go new file mode 100644 index 000000000000..66d56b8c2930 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_create.go @@ -0,0 +1,75 @@ +package servers + +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 +} + +// Create ... +func (c ServersClient) Create(ctx context.Context, id ServerId, input ServerForCreate) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ServersClient) CreateThenPoll(ctx context.Context, id ServerId, input ServerForCreate) error { + result, err := c.Create(ctx, id, input) + 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/mysql/2017-12-01/servers/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_delete.go new file mode 100644 index 000000000000..df457143e831 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_delete.go @@ -0,0 +1,71 @@ +package servers + +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 ServersClient) Delete(ctx context.Context, id ServerId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServersClient) DeleteThenPoll(ctx context.Context, id ServerId) 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/mysql/2017-12-01/servers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_get.go new file mode 100644 index 000000000000..9b0d3336c181 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_get.go @@ -0,0 +1,51 @@ +package servers + +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 *Server +} + +// Get ... +func (c ServersClient) Get(ctx context.Context, id ServerId) (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/mysql/2017-12-01/servers/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_list.go new file mode 100644 index 000000000000..b8003018aac4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_list.go @@ -0,0 +1,53 @@ +package servers + +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 *ServerListResult +} + +// List ... +func (c ServersClient) 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.DBforMySQL/servers", 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/mysql/2017-12-01/servers/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_listbyresourcegroup.go new file mode 100644 index 000000000000..08a726c15787 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_listbyresourcegroup.go @@ -0,0 +1,53 @@ +package servers + +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 *ServerListResult +} + +// ListByResourceGroup ... +func (c ServersClient) 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.DBforMySQL/servers", 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/mysql/2017-12-01/servers/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_update.go new file mode 100644 index 000000000000..0c039bb2872c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/method_update.go @@ -0,0 +1,74 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c ServersClient) Update(ctx context.Context, id ServerId, input ServerUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ServersClient) UpdateThenPoll(ctx context.Context, id ServerId, input ServerUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_privateendpointproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_privateendpointproperty.go new file mode 100644 index 000000000000..6b1eab772d2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_server.go new file mode 100644 index 000000000000..8b1b48a38b34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_server.go @@ -0,0 +1,19 @@ +package servers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Server struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ServerProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverforcreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverforcreate.go new file mode 100644 index 000000000000..171c190411b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverforcreate.go @@ -0,0 +1,48 @@ +package servers + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerForCreate struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Properties ServerPropertiesForCreate `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Unmarshaler = &ServerForCreate{} + +func (s *ServerForCreate) UnmarshalJSON(bytes []byte) error { + type alias ServerForCreate + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ServerForCreate: %+v", err) + } + + s.Identity = decoded.Identity + s.Location = decoded.Location + s.Sku = decoded.Sku + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ServerForCreate into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalServerPropertiesForCreateImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'ServerForCreate': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverlistresult.go new file mode 100644 index 000000000000..ccf6bd242703 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverlistresult.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerListResult struct { + Value *[]Server `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnection.go new file mode 100644 index 000000000000..9979a7cec1df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnection.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go new file mode 100644 index 000000000000..c30676397ef4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go new file mode 100644 index 000000000000..05d887b1bc6c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status PrivateLinkServiceConnectionStateStatus `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverproperties.go new file mode 100644 index 000000000000..18cd63a26676 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverproperties.go @@ -0,0 +1,40 @@ +package servers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + ByokEnforcement *string `json:"byokEnforcement,omitempty"` + EarliestRestoreDate *string `json:"earliestRestoreDate,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MasterServerId *string `json:"masterServerId,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicaCapacity *int64 `json:"replicaCapacity,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + UserVisibleState *ServerState `json:"userVisibleState,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +func (o *ServerProperties) GetEarliestRestoreDateAsTime() (*time.Time, error) { + if o.EarliestRestoreDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EarliestRestoreDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerProperties) SetEarliestRestoreDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EarliestRestoreDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforcreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforcreate.go new file mode 100644 index 000000000000..ef35f7ee261f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforcreate.go @@ -0,0 +1,72 @@ +package servers + +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. + +type ServerPropertiesForCreate interface { +} + +func unmarshalServerPropertiesForCreateImplementation(input []byte) (ServerPropertiesForCreate, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForCreate into map[string]interface: %+v", err) + } + + value, ok := temp["createMode"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Default") { + var out ServerPropertiesForDefaultCreate + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForDefaultCreate: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "GeoRestore") { + var out ServerPropertiesForGeoRestore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForGeoRestore: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Replica") { + var out ServerPropertiesForReplica + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForReplica: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PointInTimeRestore") { + var out ServerPropertiesForRestore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForRestore: %+v", err) + } + return out, nil + } + + type RawServerPropertiesForCreateImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawServerPropertiesForCreateImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go new file mode 100644 index 000000000000..efa1824c8386 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go @@ -0,0 +1,48 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForDefaultCreate{} + +type ServerPropertiesForDefaultCreate struct { + AdministratorLogin string `json:"administratorLogin"` + AdministratorLoginPassword string `json:"administratorLoginPassword"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForDefaultCreate{} + +func (s ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForDefaultCreate + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForDefaultCreate: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForDefaultCreate: %+v", err) + } + decoded["createMode"] = "Default" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForDefaultCreate: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforgeorestore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforgeorestore.go new file mode 100644 index 000000000000..f3775b48d536 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforgeorestore.go @@ -0,0 +1,47 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForGeoRestore{} + +type ServerPropertiesForGeoRestore struct { + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForGeoRestore{} + +func (s ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForGeoRestore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForGeoRestore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForGeoRestore: %+v", err) + } + decoded["createMode"] = "GeoRestore" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForGeoRestore: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforreplica.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforreplica.go new file mode 100644 index 000000000000..9f8a64ee6e76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforreplica.go @@ -0,0 +1,47 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForReplica{} + +type ServerPropertiesForReplica struct { + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForReplica{} + +func (s ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForReplica + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForReplica: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForReplica: %+v", err) + } + decoded["createMode"] = "Replica" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForReplica: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforrestore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforrestore.go new file mode 100644 index 000000000000..0a74bb938170 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverpropertiesforrestore.go @@ -0,0 +1,48 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForRestore{} + +type ServerPropertiesForRestore struct { + RestorePointInTime string `json:"restorePointInTime"` + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForRestore{} + +func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForRestore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForRestore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForRestore: %+v", err) + } + decoded["createMode"] = "PointInTimeRestore" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForRestore: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparameters.go new file mode 100644 index 000000000000..28d9df792f85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparameters.go @@ -0,0 +1,15 @@ +package servers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpdateParameters struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *ServerUpdateParametersProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparametersproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparametersproperties.go new file mode 100644 index 000000000000..8557ea727527 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_serverupdateparametersproperties.go @@ -0,0 +1,14 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpdateParametersProperties struct { + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_sku.go new file mode 100644 index 000000000000..8bb23cf521d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_sku.go @@ -0,0 +1,12 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_storageprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_storageprofile.go new file mode 100644 index 000000000000..ecb9b55edb0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/model_storageprofile.go @@ -0,0 +1,11 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + BackupRetentionDays *int64 `json:"backupRetentionDays,omitempty"` + GeoRedundantBackup *GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + StorageAutogrow *StorageAutogrow `json:"storageAutogrow,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/version.go new file mode 100644 index 000000000000..80804cb01558 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers/version.go @@ -0,0 +1,12 @@ +package servers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/README.md new file mode 100644 index 000000000000..1961b07d12e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies` Documentation + +The `serversecurityalertpolicies` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies" +``` + + +### Client Initialization + +```go +client := serversecurityalertpolicies.NewServerSecurityAlertPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerSecurityAlertPoliciesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := serversecurityalertpolicies.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := serversecurityalertpolicies.ServerSecurityAlertPolicy{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerSecurityAlertPoliciesClient.Get` + +```go +ctx := context.TODO() +id := serversecurityalertpolicies.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServerSecurityAlertPoliciesClient.ListByServer` + +```go +ctx := context.TODO() +id := serversecurityalertpolicies.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/client.go new file mode 100644 index 000000000000..d3b8f5dac1b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/client.go @@ -0,0 +1,26 @@ +package serversecurityalertpolicies + +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 ServerSecurityAlertPoliciesClient struct { + Client *resourcemanager.Client +} + +func NewServerSecurityAlertPoliciesClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerSecurityAlertPoliciesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serversecurityalertpolicies", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerSecurityAlertPoliciesClient: %+v", err) + } + + return &ServerSecurityAlertPoliciesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/constants.go new file mode 100644 index 000000000000..ec0c8d5ee0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/constants.go @@ -0,0 +1,51 @@ +package serversecurityalertpolicies + +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. + +type ServerSecurityAlertPolicyState string + +const ( + ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" + ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" +) + +func PossibleValuesForServerSecurityAlertPolicyState() []string { + return []string{ + string(ServerSecurityAlertPolicyStateDisabled), + string(ServerSecurityAlertPolicyStateEnabled), + } +} + +func (s *ServerSecurityAlertPolicyState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerSecurityAlertPolicyState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerSecurityAlertPolicyState(input string) (*ServerSecurityAlertPolicyState, error) { + vals := map[string]ServerSecurityAlertPolicyState{ + "disabled": ServerSecurityAlertPolicyStateDisabled, + "enabled": ServerSecurityAlertPolicyStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerSecurityAlertPolicyState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go new file mode 100644 index 000000000000..a387281b4b42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go @@ -0,0 +1,127 @@ +package serversecurityalertpolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_createorupdate.go new file mode 100644 index 000000000000..0979c95c08b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_createorupdate.go @@ -0,0 +1,74 @@ +package serversecurityalertpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, id ServerId, input ServerSecurityAlertPolicy) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/securityAlertPolicies/default", 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 ServerSecurityAlertPoliciesClient) CreateOrUpdateThenPoll(ctx context.Context, id ServerId, input ServerSecurityAlertPolicy) 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/mysql/2017-12-01/serversecurityalertpolicies/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_get.go new file mode 100644 index 000000000000..ba5968cc3fd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_get.go @@ -0,0 +1,52 @@ +package serversecurityalertpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ServerSecurityAlertPolicy +} + +// Get ... +func (c ServerSecurityAlertPoliciesClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/securityAlertPolicies/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/mysql/2017-12-01/serversecurityalertpolicies/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_listbyserver.go new file mode 100644 index 000000000000..4281730bca37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/method_listbyserver.go @@ -0,0 +1,89 @@ +package serversecurityalertpolicies + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ServerSecurityAlertPolicy +} + +type ListByServerCompleteResult struct { + Items []ServerSecurityAlertPolicy +} + +// ListByServer ... +func (c ServerSecurityAlertPoliciesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/securityAlertPolicies", 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 *[]ServerSecurityAlertPolicy `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServerComplete retrieves all the results into a single object +func (c ServerSecurityAlertPoliciesClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, ServerSecurityAlertPolicyOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ServerSecurityAlertPoliciesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate ServerSecurityAlertPolicyOperationPredicate) (result ListByServerCompleteResult, err error) { + items := make([]ServerSecurityAlertPolicy, 0) + + resp, err := c.ListByServer(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 = ListByServerCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go new file mode 100644 index 000000000000..cdccecef6a5d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go @@ -0,0 +1,14 @@ +package serversecurityalertpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityAlertPolicyProperties struct { + DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` + EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` + EmailAddresses *[]string `json:"emailAddresses,omitempty"` + RetentionDays *int64 `json:"retentionDays,omitempty"` + State ServerSecurityAlertPolicyState `json:"state"` + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageEndpoint *string `json:"storageEndpoint,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go new file mode 100644 index 000000000000..6e2a30d2abae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go @@ -0,0 +1,11 @@ +package serversecurityalertpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerSecurityAlertPolicy struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SecurityAlertPolicyProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/predicates.go new file mode 100644 index 000000000000..ff213a5f2929 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/predicates.go @@ -0,0 +1,27 @@ +package serversecurityalertpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerSecurityAlertPolicyOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ServerSecurityAlertPolicyOperationPredicate) Matches(input ServerSecurityAlertPolicy) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/version.go new file mode 100644 index 000000000000..f7fc4c20d1df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/version.go @@ -0,0 +1,12 @@ +package serversecurityalertpolicies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serversecurityalertpolicies/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/README.md new file mode 100644 index 000000000000..be4f54383734 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules` Documentation + +The `virtualnetworkrules` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules" +``` + + +### Client Initialization + +```go +client := virtualnetworkrules.NewVirtualNetworkRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworkRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +payload := virtualnetworkrules.VirtualNetworkRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/client.go new file mode 100644 index 000000000000..1395850f955e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/client.go @@ -0,0 +1,26 @@ +package virtualnetworkrules + +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 VirtualNetworkRulesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualNetworkRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualNetworkRulesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualnetworkrules", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualNetworkRulesClient: %+v", err) + } + + return &VirtualNetworkRulesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/constants.go new file mode 100644 index 000000000000..6e2ce1104f43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/constants.go @@ -0,0 +1,60 @@ +package virtualnetworkrules + +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. + +type VirtualNetworkRuleState string + +const ( + VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" + VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" + VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" + VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" + VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" +) + +func PossibleValuesForVirtualNetworkRuleState() []string { + return []string{ + string(VirtualNetworkRuleStateDeleting), + string(VirtualNetworkRuleStateInProgress), + string(VirtualNetworkRuleStateInitializing), + string(VirtualNetworkRuleStateReady), + string(VirtualNetworkRuleStateUnknown), + } +} + +func (s *VirtualNetworkRuleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualNetworkRuleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualNetworkRuleState(input string) (*VirtualNetworkRuleState, error) { + vals := map[string]VirtualNetworkRuleState{ + "deleting": VirtualNetworkRuleStateDeleting, + "inprogress": VirtualNetworkRuleStateInProgress, + "initializing": VirtualNetworkRuleStateInitializing, + "ready": VirtualNetworkRuleStateReady, + "unknown": VirtualNetworkRuleStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualNetworkRuleState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go new file mode 100644 index 000000000000..e959cb6c60d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go @@ -0,0 +1,127 @@ +package virtualnetworkrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go new file mode 100644 index 000000000000..c49b840001e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -0,0 +1,140 @@ +package virtualnetworkrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = VirtualNetworkRuleId{} + +// VirtualNetworkRuleId is a struct representing the Resource ID for a Virtual Network Rule +type VirtualNetworkRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + VirtualNetworkRuleName string +} + +// NewVirtualNetworkRuleID returns a new VirtualNetworkRuleId struct +func NewVirtualNetworkRuleID(subscriptionId string, resourceGroupName string, serverName string, virtualNetworkRuleName string) VirtualNetworkRuleId { + return VirtualNetworkRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + VirtualNetworkRuleName: virtualNetworkRuleName, + } +} + +// ParseVirtualNetworkRuleID parses 'input' into a VirtualNetworkRuleId +func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + } + + return &id, nil +} + +// ParseVirtualNetworkRuleIDInsensitively parses 'input' case-insensitively into a VirtualNetworkRuleId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + } + + return &id, nil +} + +// ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID +func ValidateVirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualNetworkRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network Rule ID +func (id VirtualNetworkRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/virtualNetworkRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.VirtualNetworkRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network Rule ID +func (id VirtualNetworkRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticVirtualNetworkRules", "virtualNetworkRules", "virtualNetworkRules"), + resourceids.UserSpecifiedSegment("virtualNetworkRuleName", "virtualNetworkRuleValue"), + } +} + +// String returns a human-readable description of this Virtual Network Rule ID +func (id VirtualNetworkRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Virtual Network Rule Name: %q", id.VirtualNetworkRuleName), + } + return fmt.Sprintf("Virtual Network Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_createorupdate.go new file mode 100644 index 000000000000..f7333550ca97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 VirtualNetworkRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) 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/mysql/2017-12-01/virtualnetworkrules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_delete.go new file mode 100644 index 000000000000..bba879aa2de5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_delete.go @@ -0,0 +1,71 @@ +package virtualnetworkrules + +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 VirtualNetworkRulesClient) Delete(ctx context.Context, id VirtualNetworkRuleId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworkRulesClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkRuleId) 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/mysql/2017-12-01/virtualnetworkrules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_get.go new file mode 100644 index 000000000000..28e51535538a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_get.go @@ -0,0 +1,51 @@ +package virtualnetworkrules + +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 *VirtualNetworkRule +} + +// Get ... +func (c VirtualNetworkRulesClient) Get(ctx context.Context, id VirtualNetworkRuleId) (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/mysql/2017-12-01/virtualnetworkrules/method_listbyserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_listbyserver.go new file mode 100644 index 000000000000..86cef39f6ccf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/method_listbyserver.go @@ -0,0 +1,89 @@ +package virtualnetworkrules + +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 ListByServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualNetworkRule +} + +type ListByServerCompleteResult struct { + Items []VirtualNetworkRule +} + +// ListByServer ... +func (c VirtualNetworkRulesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/virtualNetworkRules", 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 *[]VirtualNetworkRule `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServerComplete retrieves all the results into a single object +func (c VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, VirtualNetworkRuleOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworkRulesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate VirtualNetworkRuleOperationPredicate) (result ListByServerCompleteResult, err error) { + items := make([]VirtualNetworkRule, 0) + + resp, err := c.ListByServer(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 = ListByServerCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go new file mode 100644 index 000000000000..16850c4e56f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go @@ -0,0 +1,11 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualNetworkRuleProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go new file mode 100644 index 000000000000..40e8ec8d2417 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go @@ -0,0 +1,10 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRuleProperties struct { + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + State *VirtualNetworkRuleState `json:"state,omitempty"` + VirtualNetworkSubnetId string `json:"virtualNetworkSubnetId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/predicates.go new file mode 100644 index 000000000000..9170201b8d55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/predicates.go @@ -0,0 +1,27 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualNetworkRuleOperationPredicate) Matches(input VirtualNetworkRule) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/version.go new file mode 100644 index 000000000000..11bd3d9075aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules/version.go @@ -0,0 +1,12 @@ +package virtualnetworkrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworkrules/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index cfc8c212eb80..c236d9ae445f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -492,6 +492,22 @@ github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simg github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simpolicy github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01 +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/checknameavailability +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurationsupdate +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/locationbasedperformancetier +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/logfiles +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/recoverableservers +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/replicas +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverbasedperformancetier +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestart +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01 github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/backups github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/checknameavailability From 3393df1504f406671bbfbbdc8162f2f5bef688b5 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 14:20:10 -0700 Subject: [PATCH 02/12] swap azurerm_mysql_database to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 5 - .../services/mysql/mysql_database_resource.go | 57 ++++---- .../mysql/mysql_database_resource_test.go | 8 +- internal/services/mysql/parse/database.go | 78 ----------- .../services/mysql/parse/database_test.go | 131 ------------------ internal/services/mysql/resourceids.go | 1 - .../services/mysql/validate/database_id.go | 26 ---- .../mysql/validate/database_id_test.go | 91 ------------ 8 files changed, 30 insertions(+), 367 deletions(-) delete mode 100644 internal/services/mysql/parse/database.go delete mode 100644 internal/services/mysql/parse/database_test.go delete mode 100644 internal/services/mysql/validate/database_id.go delete mode 100644 internal/services/mysql/validate/database_id_test.go diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index d1562c16bc5c..2f67741ba507 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -18,7 +18,6 @@ type Client struct { FlexibleServers *flexibleServers_v2021_05_01.Client MySqlClient *servers_v2017_12_01.Client - DatabasesClient *mysql.DatabasesClient FirewallRulesClient *mysql.FirewallRulesClient ServersClient *mysql.ServersClient ServerKeysClient *mysql.ServerKeysClient @@ -51,9 +50,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) - DatabasesClient := mysql.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&DatabasesClient.Client, o.ResourceManagerAuthorizer) - FirewallRulesClient := mysql.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&FirewallRulesClient.Client, o.ResourceManagerAuthorizer) @@ -78,7 +74,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { // TODO: switch to using the Meta Clients AzureADAdministratorsClient: azureADAdministratorsClient, - DatabasesClient: &DatabasesClient, FirewallRulesClient: &FirewallRulesClient, ServersClient: &ServersClient, ServerKeysClient: &ServerKeysClient, diff --git a/internal/services/mysql/mysql_database_resource.go b/internal/services/mysql/mysql_database_resource.go index 818ea60411ea..1b8fb4af4320 100644 --- a/internal/services/mysql/mysql_database_resource.go +++ b/internal/services/mysql/mysql_database_resource.go @@ -8,11 +8,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -26,7 +26,7 @@ func resourceMySqlDatabase() *pluginsdk.Resource { Read: resourceMySqlDatabaseRead, Delete: resourceMySqlDatabaseDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatabaseID(id) + _, err := databases.ParseDatabaseID(id) return err }), @@ -70,7 +70,7 @@ func resourceMySqlDatabase() *pluginsdk.Resource { } func resourceMySqlDatabaseCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.DatabasesClient + client := meta.(*clients.Client).MySQL.MySqlClient.Databases subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -80,86 +80,81 @@ func resourceMySqlDatabaseCreate(d *pluginsdk.ResourceData, meta interface{}) er charset := d.Get("charset").(string) collation := d.Get("collation").(string) - id := parse.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mysql_database", id.ID()) } } - properties := mysql.Database{ - DatabaseProperties: &mysql.DatabaseProperties{ + properties := databases.Database{ + Properties: &databases.DatabaseProperties{ Charset: utils.String(charset), Collation: utils.String(collation), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating %s: %v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on creation of %s: %v", id, err) - } d.SetId(id.ID()) return resourceMySqlDatabaseRead(d, meta) } func resourceMySqlDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.DatabasesClient + client := meta.(*clients.Client).MySQL.MySqlClient.Databases ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.DatabaseName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("charset", resp.Charset) - d.Set("collation", resp.Collation) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("charset", props.Charset) + d.Set("collation", props.Collation) + } + } return nil } func resourceMySqlDatabaseDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.DatabasesClient + client := meta.(*clients.Client).MySQL.MySqlClient.Databases ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/mysql/mysql_database_resource_test.go b/internal/services/mysql/mysql_database_resource_test.go index e0f0a1d86aaf..5caba71fac4f 100644 --- a/internal/services/mysql/mysql_database_resource_test.go +++ b/internal/services/mysql/mysql_database_resource_test.go @@ -8,10 +8,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -84,17 +84,17 @@ func TestAccMySQLDatabase_charsetMixedcase(t *testing.T) { } func (r MySQLDatabaseResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DatabaseID(state.ID) + id, err := databases.ParseDatabaseID(state.ID) if err != nil { return nil, err } - resp, err := clients.MySQL.DatabasesClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := clients.MySQL.MySqlClient.Databases.Get(ctx, *id) if err != nil { return nil, err } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (MySQLDatabaseResource) basic(data acceptance.TestData) string { diff --git a/internal/services/mysql/parse/database.go b/internal/services/mysql/parse/database.go deleted file mode 100644 index cb50d3f9d773..000000000000 --- a/internal/services/mysql/parse/database.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DatabaseId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewDatabaseID(subscriptionId, resourceGroup, serverName, name string) DatabaseId { - return DatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id DatabaseId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Database", segmentsStr) -} - -func (id DatabaseId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// DatabaseID parses a Database ID into an DatabaseId struct -func DatabaseID(input string) (*DatabaseId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an Database ID: %+v", input, err) - } - - resourceId := DatabaseId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("databases"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/mysql/parse/database_test.go b/internal/services/mysql/parse/database_test.go deleted file mode 100644 index ac4a03643a50..000000000000 --- a/internal/services/mysql/parse/database_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DatabaseId{} - -func TestDatabaseIDFormatter(t *testing.T) { - actual := NewDatabaseID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "database1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/database1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDatabaseID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DatabaseId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/database1", - Expected: &DatabaseId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ServerName: "server1", - Name: "database1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/DATABASES/DATABASE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DatabaseID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ServerName != v.Expected.ServerName { - t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index 469ecf093d61..d385a60f2353 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -4,7 +4,6 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/administrators/activeDirectory -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Database -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/database1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/firewallRule1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerAzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/server1/administrators/ActiveDirectory diff --git a/internal/services/mysql/validate/database_id.go b/internal/services/mysql/validate/database_id.go deleted file mode 100644 index 4678f2e3098f..000000000000 --- a/internal/services/mysql/validate/database_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" -) - -func DatabaseID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DatabaseID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/mysql/validate/database_id_test.go b/internal/services/mysql/validate/database_id_test.go deleted file mode 100644 index 982d6391f42c..000000000000 --- a/internal/services/mysql/validate/database_id_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDatabaseID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Valid: false, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/database1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/DATABASES/DATABASE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DatabaseID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} From 58a657300bab4f8641c36e1b81d4e1b4c44498e9 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 15:28:35 -0700 Subject: [PATCH 03/12] swap azurerm_mysql_firewall_rule to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 5 - .../mysql/mysql_firewall_rule_resource.go | 61 ++++---- .../mysql_firewall_rule_resource_test.go | 8 +- .../services/mysql/parse/firewall_rule.go | 78 ----------- .../mysql/parse/firewall_rule_test.go | 131 ------------------ internal/services/mysql/resourceids.go | 1 - .../mysql/validate/firewall_rule_id.go | 26 ---- .../mysql/validate/firewall_rule_id_test.go | 91 ------------ 8 files changed, 30 insertions(+), 371 deletions(-) delete mode 100644 internal/services/mysql/parse/firewall_rule.go delete mode 100644 internal/services/mysql/parse/firewall_rule_test.go delete mode 100644 internal/services/mysql/validate/firewall_rule_id.go delete mode 100644 internal/services/mysql/validate/firewall_rule_id_test.go diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index 2f67741ba507..7bc8e7a359b9 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -18,7 +18,6 @@ type Client struct { FlexibleServers *flexibleServers_v2021_05_01.Client MySqlClient *servers_v2017_12_01.Client - FirewallRulesClient *mysql.FirewallRulesClient ServersClient *mysql.ServersClient ServerKeysClient *mysql.ServerKeysClient ServerSecurityAlertPoliciesClient *mysql.ServerSecurityAlertPoliciesClient @@ -50,9 +49,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) - FirewallRulesClient := mysql.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&FirewallRulesClient.Client, o.ResourceManagerAuthorizer) - ServersClient := mysql.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ServersClient.Client, o.ResourceManagerAuthorizer) @@ -74,7 +70,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { // TODO: switch to using the Meta Clients AzureADAdministratorsClient: azureADAdministratorsClient, - FirewallRulesClient: &FirewallRulesClient, ServersClient: &ServersClient, ServerKeysClient: &ServerKeysClient, ServerSecurityAlertPoliciesClient: &serverSecurityAlertPoliciesClient, diff --git a/internal/services/mysql/mysql_firewall_rule_resource.go b/internal/services/mysql/mysql_firewall_rule_resource.go index 8accf6a28b39..4b7d297cde7d 100644 --- a/internal/services/mysql/mysql_firewall_rule_resource.go +++ b/internal/services/mysql/mysql_firewall_rule_resource.go @@ -8,16 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceMySqlFirewallRule() *pluginsdk.Resource { @@ -28,7 +27,7 @@ func resourceMySqlFirewallRule() *pluginsdk.Resource { Delete: resourceMySqlFirewallRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FirewallRuleID(id) + _, err := firewallrules.ParseFirewallRuleID(id) return err }), @@ -72,7 +71,7 @@ func resourceMySqlFirewallRule() *pluginsdk.Resource { } func resourceMySqlFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.FirewallRulesClient + client := meta.(*clients.Client).MySQL.MySqlClient.FirewallRules subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -81,87 +80,79 @@ func resourceMySqlFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta inter startIPAddress := d.Get("start_ip_address").(string) endIPAddress := d.Get("end_ip_address").(string) - id := parse.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := firewallrules.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mysql_firewall_rule", id.ID()) } } - properties := mysql.FirewallRule{ - FirewallRuleProperties: &mysql.FirewallRuleProperties{ - StartIPAddress: utils.String(startIPAddress), - EndIPAddress: utils.String(endIPAddress), + properties := firewallrules.FirewallRule{ + Properties: firewallrules.FirewallRuleProperties{ + StartIPAddress: startIPAddress, + EndIPAddress: endIPAddress, }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating/updating %s: %v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %v", id, err) - } - d.SetId(id.ID()) return resourceMySqlFirewallRuleRead(d, meta) } func resourceMySqlFirewallRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.FirewallRulesClient + client := meta.(*clients.Client).MySQL.MySqlClient.FirewallRules ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.FirewallRuleName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("start_ip_address", resp.StartIPAddress) - d.Set("end_ip_address", resp.EndIPAddress) + if model := resp.Model; model != nil { + d.Set("start_ip_address", model.Properties.StartIPAddress) + d.Set("end_ip_address", model.Properties.EndIPAddress) + } return nil } func resourceMySqlFirewallRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.FirewallRulesClient + client := meta.(*clients.Client).MySQL.MySqlClient.FirewallRules ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/mysql/mysql_firewall_rule_resource_test.go b/internal/services/mysql/mysql_firewall_rule_resource_test.go index b2a838f8a122..d58e1b940c83 100644 --- a/internal/services/mysql/mysql_firewall_rule_resource_test.go +++ b/internal/services/mysql/mysql_firewall_rule_resource_test.go @@ -8,10 +8,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -49,17 +49,17 @@ func TestAccMySQLFirewallRule_requiresImport(t *testing.T) { } func (t MySQLFirewallRuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FirewallRuleID(state.ID) + id, err := firewallrules.ParseFirewallRuleID(state.ID) if err != nil { return nil, err } - resp, err := clients.MySQL.FirewallRulesClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := clients.MySQL.MySqlClient.FirewallRules.Get(ctx, *id) if err != nil { return nil, err } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (MySQLFirewallRuleResource) basic(data acceptance.TestData) string { diff --git a/internal/services/mysql/parse/firewall_rule.go b/internal/services/mysql/parse/firewall_rule.go deleted file mode 100644 index b68b90ebeee9..000000000000 --- a/internal/services/mysql/parse/firewall_rule.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FirewallRuleId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewFirewallRuleID(subscriptionId, resourceGroup, serverName, name string) FirewallRuleId { - return FirewallRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id FirewallRuleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Firewall Rule", segmentsStr) -} - -func (id FirewallRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/firewallRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// FirewallRuleID parses a FirewallRule ID into an FirewallRuleId struct -func FirewallRuleID(input string) (*FirewallRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an FirewallRule ID: %+v", input, err) - } - - resourceId := FirewallRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("firewallRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/mysql/parse/firewall_rule_test.go b/internal/services/mysql/parse/firewall_rule_test.go deleted file mode 100644 index 87913672a388..000000000000 --- a/internal/services/mysql/parse/firewall_rule_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = FirewallRuleId{} - -func TestFirewallRuleIDFormatter(t *testing.T) { - actual := NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "firewallRule1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/firewallRule1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestFirewallRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FirewallRuleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/firewallRule1", - Expected: &FirewallRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ServerName: "server1", - Name: "firewallRule1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/FIREWALLRULES/FIREWALLRULE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := FirewallRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ServerName != v.Expected.ServerName { - t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index d385a60f2353..3069e7fac96d 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -4,7 +4,6 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/administrators/activeDirectory -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/firewallRule1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerAzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/server1/administrators/ActiveDirectory //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Server -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1 -rewrite=true diff --git a/internal/services/mysql/validate/firewall_rule_id.go b/internal/services/mysql/validate/firewall_rule_id.go deleted file mode 100644 index 862478127f78..000000000000 --- a/internal/services/mysql/validate/firewall_rule_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" -) - -func FirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FirewallRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/mysql/validate/firewall_rule_id_test.go b/internal/services/mysql/validate/firewall_rule_id_test.go deleted file mode 100644 index b05ed225975b..000000000000 --- a/internal/services/mysql/validate/firewall_rule_id_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestFirewallRuleID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Valid: false, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/firewallRules/firewallRule1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/FIREWALLRULES/FIREWALLRULE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := FirewallRuleID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} From ca35e22bf9a39594323388e504c39787ab59a1c3 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 16:04:50 -0700 Subject: [PATCH 04/12] swap azurerm_mysql_server to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 5 - .../mysql/mysql_server_data_source.go | 108 ++--- .../mysql/mysql_server_key_resource.go | 20 +- .../services/mysql/mysql_server_resource.go | 420 ++++++++---------- .../mysql/mysql_server_resource_test.go | 8 +- internal/services/mysql/parse/server.go | 116 ----- internal/services/mysql/parse/server_test.go | 232 ---------- internal/services/mysql/resourceids.go | 1 - internal/services/mysql/validate/server_id.go | 26 -- .../services/mysql/validate/server_id_test.go | 79 ---- .../network/private_endpoint_resource.go | 4 +- ...ng_cloud_app_mysql_association_resource.go | 4 +- 12 files changed, 257 insertions(+), 766 deletions(-) delete mode 100644 internal/services/mysql/parse/server.go delete mode 100644 internal/services/mysql/parse/server_test.go delete mode 100644 internal/services/mysql/validate/server_id.go delete mode 100644 internal/services/mysql/validate/server_id_test.go diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index 7bc8e7a359b9..c33328bfdd7c 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -18,7 +18,6 @@ type Client struct { FlexibleServers *flexibleServers_v2021_05_01.Client MySqlClient *servers_v2017_12_01.Client - ServersClient *mysql.ServersClient ServerKeysClient *mysql.ServerKeysClient ServerSecurityAlertPoliciesClient *mysql.ServerSecurityAlertPoliciesClient VirtualNetworkRulesClient *mysql.VirtualNetworkRulesClient @@ -49,9 +48,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) - ServersClient := mysql.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ServersClient.Client, o.ResourceManagerAuthorizer) - ServerKeysClient := mysql.NewServerKeysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ServerKeysClient.Client, o.ResourceManagerAuthorizer) @@ -70,7 +66,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { // TODO: switch to using the Meta Clients AzureADAdministratorsClient: azureADAdministratorsClient, - ServersClient: &ServersClient, ServerKeysClient: &ServerKeysClient, ServerSecurityAlertPoliciesClient: &serverSecurityAlertPoliciesClient, VirtualNetworkRulesClient: &VirtualNetworkRulesClient, diff --git a/internal/services/mysql/mysql_server_data_source.go b/internal/services/mysql/mysql_server_data_source.go index 637f3dc99a37..cc5a2fad2695 100644 --- a/internal/services/mysql/mysql_server_data_source.go +++ b/internal/services/mysql/mysql_server_data_source.go @@ -7,16 +7,18 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceMySqlServer() *pluginsdk.Resource { @@ -152,7 +154,7 @@ func dataSourceMySqlServer() *pluginsdk.Resource { }, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), "version": { Type: pluginsdk.TypeString, @@ -163,72 +165,78 @@ func dataSourceMySqlServer() *pluginsdk.Resource { } func dataSourceMySqlServerRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServersClient + client := meta.(*clients.Client).MySQL.MySqlClient.Servers subscriptionId := meta.(*clients.Client).Account.SubscriptionId - securityClient := meta.(*clients.Client).MySQL.ServerSecurityAlertPoliciesClient + securityClient := meta.(*clients.Client).MySQL.MySqlClient.ServerSecurityAlertPolicies ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := servers.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - - tier := mysql.Basic - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) - tier = sku.Tier - } + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("identity", flattenServerIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("infrastructure_encryption_enabled", props.InfrastructureEncryption == mysql.InfrastructureEncryptionEnabled) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == mysql.PublicNetworkAccessEnumEnabled) - d.Set("ssl_enforcement_enabled", props.SslEnforcement == mysql.SslEnforcementEnumEnabled) - d.Set("ssl_minimal_tls_version_enforced", props.MinimalTLSVersion) - d.Set("version", string(props.Version)) - - if storage := props.StorageProfile; storage != nil { - d.Set("auto_grow_enabled", storage.StorageAutogrow == mysql.StorageAutogrowEnabled) - d.Set("backup_retention_days", storage.BackupRetentionDays) - d.Set("geo_redundant_backup_enabled", storage.GeoRedundantBackup == mysql.Enabled) - d.Set("storage_mb", storage.StorageMB) + tier := servers.SkuTierBasic + if sku := model.Sku; sku != nil { + d.Set("sku_name", sku.Name) + tier = pointer.From(sku.Tier) } - d.Set("fqdn", props.FullyQualifiedDomainName) - } - - if tier == mysql.GeneralPurpose || tier == mysql.MemoryOptimized { - secResp, err := securityClient.Get(ctx, id.ResourceGroup, id.Name) - if err != nil && !utils.ResponseWasNotFound(secResp.Response) { - return fmt.Errorf("retrieving Security Alert Policy for %s: %+v", id, err) + if err := d.Set("identity", identity.FlattenSystemAssigned(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) } - accountKey := "" - if secResp.SecurityAlertPolicyProperties != nil && secResp.SecurityAlertPolicyProperties.StorageAccountAccessKey != nil { - accountKey = *secResp.SecurityAlertPolicyProperties.StorageAccountAccessKey + if props := model.Properties; props != nil { + d.Set("administrator_login", props.AdministratorLogin) + d.Set("infrastructure_encryption_enabled", pointer.From(props.InfrastructureEncryption) == servers.InfrastructureEncryptionEnabled) + d.Set("public_network_access_enabled", pointer.From(props.PublicNetworkAccess) == servers.PublicNetworkAccessEnumEnabled) + d.Set("ssl_enforcement_enabled", pointer.From(props.SslEnforcement) == servers.SslEnforcementEnumEnabled) + d.Set("ssl_minimal_tls_version_enforced", props.MinimalTlsVersion) + d.Set("version", props.Version) + + if storage := props.StorageProfile; storage != nil { + d.Set("auto_grow_enabled", pointer.From(storage.StorageAutogrow) == servers.StorageAutogrowEnabled) + d.Set("backup_retention_days", storage.BackupRetentionDays) + d.Set("geo_redundant_backup_enabled", pointer.From(storage.GeoRedundantBackup) == servers.GeoRedundantBackupEnabled) + d.Set("storage_mb", storage.StorageMB) + } + + d.Set("fqdn", props.FullyQualifiedDomainName) } - if !utils.ResponseWasNotFound(secResp.Response) { - block := flattenSecurityAlertPolicy(secResp.SecurityAlertPolicyProperties, accountKey) - if err := d.Set("threat_detection_policy", block); err != nil { - return fmt.Errorf("setting `threat_detection_policy`: %+v", err) + if tier == servers.SkuTierGeneralPurpose || tier == servers.SkuTierMemoryOptimized { + securityServerId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + secResp, err := securityClient.Get(ctx, securityServerId) + if err != nil && !response.WasNotFound(secResp.HttpResponse) { + return fmt.Errorf("retrieving Security Alert Policy for %s: %+v", id, err) + } + + accountKey := "" + if secResp.Model != nil && secResp.Model.Properties != nil && secResp.Model.Properties.StorageAccountAccessKey != nil { + accountKey = *secResp.Model.Properties.StorageAccountAccessKey + } + + if !response.WasNotFound(secResp.HttpResponse) { + block := flattenSecurityAlertPolicy(secResp.Model.Properties, accountKey) + if err := d.Set("threat_detection_policy", block); err != nil { + return fmt.Errorf("setting `threat_detection_policy`: %+v", err) + } } } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/mysql/mysql_server_key_resource.go b/internal/services/mysql/mysql_server_key_resource.go index 0672bf82f544..bd42af7c16e6 100644 --- a/internal/services/mysql/mysql_server_key_resource.go +++ b/internal/services/mysql/mysql_server_key_resource.go @@ -11,6 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" @@ -18,7 +19,6 @@ import ( keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" resourcesClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -49,7 +49,7 @@ func resourceMySQLServerKey() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ServerID, + ValidateFunc: servers.ValidateServerID, }, "key_vault_key_id": { @@ -84,21 +84,21 @@ func resourceMySQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - serverID, err := parse.ServerID(d.Get("server_id").(string)) + serverID, err := servers.ParseServerID(d.Get("server_id").(string)) if err != nil { return err } - locks.ByName(serverID.Name, mySQLServerResourceName) - defer locks.UnlockByName(serverID.Name, mySQLServerResourceName) + locks.ByName(serverID.ServerName, mySQLServerResourceName) + defer locks.UnlockByName(serverID.ServerName, mySQLServerResourceName) if d.IsNewResource() { // This resource is a singleton, but its name can be anything. // If you create a new key with different name with the old key, the service will not give you any warning but directly replace the old key with the new key. // Therefore sometimes you cannot get the old key using the GET API since you may not know the name of the old key - resp, err := keysClient.List(ctx, serverID.ResourceGroup, serverID.Name) + resp, err := keysClient.List(ctx, serverID.ResourceGroupName, serverID.ServerName) if err != nil { - return fmt.Errorf("listing existing MySQL Server Keys in Resource Group %q / Server %q: %+v", serverID.ResourceGroup, serverID.Name, err) + return fmt.Errorf("listing existing MySQL Server Keys in %s", serverID, err) } keys := resp.Values() if len(keys) > 0 { @@ -121,10 +121,10 @@ func resourceMySQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta interfac keyVaultKeyURI := d.Get("key_vault_key_id").(string) name, err := getMySQLServerKeyName(ctx, keyVaultsClient, resourcesClient, keyVaultKeyURI) if err != nil { - return fmt.Errorf("cannot compose name for MySQL Server Key (Resource Group %q / Server %q): %+v", serverID.ResourceGroup, serverID.Name, err) + return fmt.Errorf("cannot compose name for MySQL Server Key (Resource Group %q / Server %q): %+v", serverID.ResourceGroupName, serverID.ServerName, err) } - id := parse.NewKeyID(serverID.SubscriptionId, serverID.ResourceGroup, serverID.Name, *name) + id := parse.NewKeyID(serverID.SubscriptionId, serverID.ResourceGroupName, serverID.ServerName, *name) param := mysql.ServerKey{ ServerKeyProperties: &mysql.ServerKeyProperties{ ServerKeyType: utils.String("AzureKeyVault"), @@ -165,7 +165,7 @@ func resourceMySQLServerKeyRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("retrieving %s: %+v", *id, err) } - serverId := parse.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) + serverId := servers.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) d.Set("server_id", serverId.ID()) if props := resp.ServerKeyProperties; props != nil { d.Set("key_vault_key_id", props.URI) diff --git a/internal/services/mysql/mysql_server_resource.go b/internal/services/mysql/mysql_server_resource.go index 75cf70a5538e..c14ed4bc7ac9 100644 --- a/internal/services/mysql/mysql_server_resource.go +++ b/internal/services/mysql/mysql_server_resource.go @@ -11,17 +11,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -40,7 +41,7 @@ func resourceMySqlServer() *pluginsdk.Resource { Delete: resourceMySqlServerDelete, Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.ServerID(id) + _, err := servers.ParseServerID(id) return err }, func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) { d.Set("create_mode", "Default") @@ -95,19 +96,19 @@ func resourceMySqlServer() *pluginsdk.Resource { "create_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(mysql.CreateModeDefault), + Default: string(servers.CreateModeDefault), ValidateFunc: validation.StringInSlice([]string{ - string(mysql.CreateModeDefault), - string(mysql.CreateModeGeoRestore), - string(mysql.CreateModePointInTimeRestore), - string(mysql.CreateModeReplica), + string(servers.CreateModeDefault), + string(servers.CreateModeGeoRestore), + string(servers.CreateModePointInTimeRestore), + string(servers.CreateModeReplica), }, false), }, "creation_source_server_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.ServerID, + ValidateFunc: servers.ValidateServerID, }, "fqdn": { @@ -180,12 +181,12 @@ func resourceMySqlServer() *pluginsdk.Resource { "ssl_minimal_tls_version_enforced": { Type: pluginsdk.TypeString, Optional: true, - Default: string(mysql.TLS12), + Default: string(servers.MinimalTlsVersionEnumTLSOneTwo), ValidateFunc: validation.StringInSlice([]string{ - string(mysql.TLSEnforcementDisabled), - string(mysql.TLS10), - string(mysql.TLS11), - string(mysql.TLS12), + string(servers.MinimalTlsVersionEnumTLSEnforcementDisabled), + string(servers.MinimalTlsVersionEnumTLSOneZero), + string(servers.MinimalTlsVersionEnumTLSOneTwo), + string(servers.MinimalTlsVersionEnumTLSOneTwo), }, false), }, @@ -298,14 +299,14 @@ func resourceMySqlServer() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "version": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(mysql.FiveFullStopSeven), - string(mysql.EightFullStopZero), + string(servers.ServerVersionFivePointSeven), + string(servers.ServerVersionEightPointZero), }, false), ForceNew: true, }, @@ -331,9 +332,9 @@ func resourceMySqlServer() *pluginsdk.Resource { } func resourceMySqlServerCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServersClient + client := meta.(*clients.Client).MySQL.MySqlClient.Servers subscriptionId := meta.(*clients.Client).Account.SubscriptionId - securityClient := meta.(*clients.Client).MySQL.ServerSecurityAlertPoliciesClient + securityClient := meta.(*clients.Client).MySQL.MySqlClient.ServerSecurityAlertPolicies ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -341,54 +342,54 @@ func resourceMySqlServerCreate(d *pluginsdk.ResourceData, meta interface{}) erro location := azure.NormalizeLocation(d.Get("location").(string)) - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := servers.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mysql_server", id.ID()) } } - mode := mysql.CreateMode(d.Get("create_mode").(string)) - tlsMin := mysql.MinimalTLSVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)) + mode := servers.CreateMode(d.Get("create_mode").(string)) + tlsMin := servers.MinimalTlsVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)) source := d.Get("creation_source_server_id").(string) - version := mysql.ServerVersion(d.Get("version").(string)) + version := servers.ServerVersion(d.Get("version").(string)) sku, err := expandServerSkuName(d.Get("sku_name").(string)) if err != nil { return fmt.Errorf("expanding sku_name for %s: %v", id, err) } - infraEncrypt := mysql.InfrastructureEncryptionEnabled + infraEncrypt := servers.InfrastructureEncryptionEnabled if v := d.Get("infrastructure_encryption_enabled"); !v.(bool) { - infraEncrypt = mysql.InfrastructureEncryptionDisabled + infraEncrypt = servers.InfrastructureEncryptionDisabled } - if sku.Tier == mysql.Basic && infraEncrypt == mysql.InfrastructureEncryptionEnabled { + if pointer.From(sku.Tier) == servers.SkuTierBasic && infraEncrypt == servers.InfrastructureEncryptionEnabled { return fmt.Errorf("`infrastructure_encryption_enabled` is not supported for sku Tier `Basic` for %s", id) } - publicAccess := mysql.PublicNetworkAccessEnumEnabled + publicAccess := servers.PublicNetworkAccessEnumEnabled if v := d.Get("public_network_access_enabled"); !v.(bool) { - publicAccess = mysql.PublicNetworkAccessEnumDisabled + publicAccess = servers.PublicNetworkAccessEnumDisabled } - ssl := mysql.SslEnforcementEnumEnabled + ssl := servers.SslEnforcementEnumEnabled if v := d.Get("ssl_enforcement_enabled"); !v.(bool) { - ssl = mysql.SslEnforcementEnumDisabled + ssl = servers.SslEnforcementEnumDisabled } storage := expandMySQLStorageProfile(d) - var props mysql.BasicServerPropertiesForCreate + var props servers.ServerPropertiesForCreate switch mode { - case mysql.CreateModeDefault: + case servers.CreateModeDefault: admin := d.Get("administrator_login").(string) pass := d.Get("administrator_login_password").(string) @@ -404,113 +405,94 @@ func resourceMySqlServerCreate(d *pluginsdk.ResourceData, meta interface{}) erro } // check admin - props = &mysql.ServerPropertiesForDefaultCreate{ - AdministratorLogin: &admin, - AdministratorLoginPassword: &pass, - CreateMode: mode, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, + props = &servers.ServerPropertiesForDefaultCreate{ + AdministratorLogin: admin, + AdministratorLoginPassword: pass, + InfrastructureEncryption: pointer.To(infraEncrypt), + PublicNetworkAccess: pointer.To(publicAccess), + MinimalTlsVersion: pointer.To(tlsMin), + SslEnforcement: pointer.To(ssl), StorageProfile: storage, - Version: version, + Version: pointer.To(version), } - case mysql.CreateModePointInTimeRestore: + case servers.CreateModePointInTimeRestore: v, ok := d.GetOk("restore_point_in_time") if !ok || v.(string) == "" { return fmt.Errorf("restore_point_in_time must be set when create_mode is PointInTimeRestore") } time, _ := time.Parse(time.RFC3339, v.(string)) // should be validated by the schema - props = &mysql.ServerPropertiesForRestore{ - CreateMode: mode, - SourceServerID: &source, - RestorePointInTime: &date.Time{ - Time: time, - }, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, + props = &servers.ServerPropertiesForRestore{ + SourceServerId: source, + RestorePointInTime: time.String(), + InfrastructureEncryption: pointer.To(infraEncrypt), + PublicNetworkAccess: pointer.To(publicAccess), + MinimalTlsVersion: pointer.To(tlsMin), + SslEnforcement: pointer.To(ssl), StorageProfile: storage, - Version: version, + Version: pointer.To(version), } - case mysql.CreateModeGeoRestore: - props = &mysql.ServerPropertiesForGeoRestore{ - CreateMode: mode, - SourceServerID: &source, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, + case servers.CreateModeGeoRestore: + props = &servers.ServerPropertiesForGeoRestore{ + SourceServerId: source, + InfrastructureEncryption: pointer.To(infraEncrypt), + PublicNetworkAccess: pointer.To(publicAccess), + MinimalTlsVersion: pointer.To(tlsMin), + SslEnforcement: pointer.To(ssl), StorageProfile: storage, - Version: version, + Version: pointer.To(version), } - case mysql.CreateModeReplica: - props = &mysql.ServerPropertiesForReplica{ - CreateMode: mode, - SourceServerID: &source, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, - Version: version, + case servers.CreateModeReplica: + props = &servers.ServerPropertiesForReplica{ + SourceServerId: source, + InfrastructureEncryption: pointer.To(infraEncrypt), + PublicNetworkAccess: pointer.To(publicAccess), + MinimalTlsVersion: pointer.To(tlsMin), + SslEnforcement: pointer.To(ssl), + Version: pointer.To(version), } } - expandedIdentity, err := expandServerIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - server := mysql.ServerForCreate{ + server := servers.ServerForCreate{ Identity: expandedIdentity, - Location: &location, + Location: location, Properties: props, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Create(ctx, id.ResourceGroup, id.Name, server) - if err != nil { + if err = client.CreateThenPoll(ctx, id, server); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) if v, ok := d.GetOk("threat_detection_policy"); ok { + securityAlertId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) alert := expandSecurityAlertPolicy(v) if alert != nil { - future, err := securityClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, *alert) - if err != nil { + if err = securityClient.CreateOrUpdateThenPoll(ctx, securityAlertId, *alert); err != nil { return fmt.Errorf("updating of Security Alert Policy for %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of Security Alert Policy for %s: %+v", id, err) - } } } // Issue tracking the REST API update failure: https://github.com/Azure/azure-rest-api-specs/issues/14117 - if mode == mysql.CreateModeReplica { - log.Printf("[INFO] changing `public_network_access_enabled` for AzureRM MySQL Server %q (Resource Group %q)", id.Name, id.ResourceGroup) - properties := mysql.ServerUpdateParameters{ - ServerUpdateParametersProperties: &mysql.ServerUpdateParametersProperties{ - PublicNetworkAccess: publicAccess, + if mode == servers.CreateModeReplica { + log.Printf("[INFO] changing `public_network_access_enabled` for %s", id) + properties := servers.ServerUpdateParameters{ + Properties: &servers.ServerUpdateParametersProperties{ + PublicNetworkAccess: pointer.To(publicAccess), }, } - future, err := client.Update(ctx, id.ResourceGroup, id.Name, properties) - if err != nil { - return fmt.Errorf("updating MySQL Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of MySQL Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.UpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } } @@ -518,8 +500,8 @@ func resourceMySqlServerCreate(d *pluginsdk.ResourceData, meta interface{}) erro } func resourceMySqlServerUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServersClient - securityClient := meta.(*clients.Client).MySQL.ServerSecurityAlertPoliciesClient + client := meta.(*clients.Client).MySQL.MySqlClient.Servers + securityClient := meta.(*clients.Client).MySQL.MySqlClient.ServerSecurityAlertPolicies ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -527,65 +509,57 @@ func resourceMySqlServerUpdate(d *pluginsdk.ResourceData, meta interface{}) erro log.Printf("[INFO] preparing arguments for AzureRM MySQL Server update.") - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return fmt.Errorf("parsing MySQL Server ID : %v", err) } sku, err := expandServerSkuName(d.Get("sku_name").(string)) if err != nil { - return fmt.Errorf("expanding sku_name for MySQL Server %q (Resource Group %q): %v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("expanding sku_name for %s: %v", id, err) } - publicAccess := mysql.PublicNetworkAccessEnumEnabled + publicAccess := servers.PublicNetworkAccessEnumEnabled if v := d.Get("public_network_access_enabled").(bool); !v { - publicAccess = mysql.PublicNetworkAccessEnumDisabled + publicAccess = servers.PublicNetworkAccessEnumDisabled } - ssl := mysql.SslEnforcementEnumEnabled + ssl := servers.SslEnforcementEnumEnabled if v := d.Get("ssl_enforcement_enabled").(bool); !v { - ssl = mysql.SslEnforcementEnumDisabled + ssl = servers.SslEnforcementEnumDisabled } storageProfile := expandMySQLStorageProfile(d) - expandedIdentity, err := expandServerIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - properties := mysql.ServerUpdateParameters{ + properties := servers.ServerUpdateParameters{ Identity: expandedIdentity, - ServerUpdateParametersProperties: &mysql.ServerUpdateParametersProperties{ + Properties: &servers.ServerUpdateParametersProperties{ AdministratorLoginPassword: utils.String(d.Get("administrator_login_password").(string)), - PublicNetworkAccess: publicAccess, - SslEnforcement: ssl, - MinimalTLSVersion: mysql.MinimalTLSVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)), + PublicNetworkAccess: pointer.To(publicAccess), + SslEnforcement: pointer.To(ssl), + MinimalTlsVersion: pointer.To(servers.MinimalTlsVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string))), StorageProfile: storageProfile, - Version: mysql.ServerVersion(d.Get("version").(string)), + Version: pointer.To(servers.ServerVersion(d.Get("version").(string))), }, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Update(ctx, id.ResourceGroup, id.Name, properties) - if err != nil { + if err := client.UpdateThenPoll(ctx, *id, properties); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } if v, ok := d.GetOk("threat_detection_policy"); ok { + securityAlertId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) alert := expandSecurityAlertPolicy(v) if alert != nil { - future, err := securityClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, *alert) - if err != nil { + if err = securityClient.CreateOrUpdateThenPoll(ctx, securityAlertId, *alert); err != nil { return fmt.Errorf("updataing mysql server security alert policy: %v", err) } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of mysql server security alert policy (server %q, resource group %q): %+v", id.Name, id.ResourceGroup, err) - } } } @@ -593,19 +567,19 @@ func resourceMySqlServerUpdate(d *pluginsdk.ResourceData, meta interface{}) erro } func resourceMySqlServerRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServersClient - securityClient := meta.(*clients.Client).MySQL.ServerSecurityAlertPoliciesClient + client := meta.(*clients.Client).MySQL.MySqlClient.Servers + securityClient := meta.(*clients.Client).MySQL.MySqlClient.ServerSecurityAlertPolicies ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -614,93 +588,94 @@ func resourceMySqlServerRead(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - - tier := mysql.Basic - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) - tier = sku.Tier - } + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("identity", flattenServerIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("infrastructure_encryption_enabled", props.InfrastructureEncryption == mysql.InfrastructureEncryptionEnabled) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == mysql.PublicNetworkAccessEnumEnabled) - d.Set("ssl_enforcement_enabled", props.SslEnforcement == mysql.SslEnforcementEnumEnabled) - d.Set("ssl_minimal_tls_version_enforced", props.MinimalTLSVersion) - d.Set("version", string(props.Version)) + tier := servers.SkuTierBasic + if sku := model.Sku; sku != nil { + d.Set("sku_name", sku.Name) + tier = pointer.From(sku.Tier) + } - if storage := props.StorageProfile; storage != nil { - d.Set("auto_grow_enabled", storage.StorageAutogrow == mysql.StorageAutogrowEnabled) - d.Set("backup_retention_days", storage.BackupRetentionDays) - d.Set("geo_redundant_backup_enabled", storage.GeoRedundantBackup == mysql.Enabled) - d.Set("storage_mb", storage.StorageMB) + if err := d.Set("identity", identity.FlattenSystemAssigned(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) } - // Computed - d.Set("fqdn", props.FullyQualifiedDomainName) - } + if props := model.Properties; props != nil { + d.Set("administrator_login", props.AdministratorLogin) + d.Set("infrastructure_encryption_enabled", pointer.From(props.InfrastructureEncryption) == servers.InfrastructureEncryptionEnabled) + d.Set("public_network_access_enabled", pointer.From(props.PublicNetworkAccess) == servers.PublicNetworkAccessEnumEnabled) + d.Set("ssl_enforcement_enabled", pointer.From(props.SslEnforcement) == servers.SslEnforcementEnumEnabled) + d.Set("ssl_minimal_tls_version_enforced", props.MinimalTlsVersion) + d.Set("version", props.Version) + + if storage := props.StorageProfile; storage != nil { + d.Set("auto_grow_enabled", pointer.From(storage.StorageAutogrow) == servers.StorageAutogrowEnabled) + d.Set("backup_retention_days", storage.BackupRetentionDays) + d.Set("geo_redundant_backup_enabled", pointer.From(storage.GeoRedundantBackup) == servers.GeoRedundantBackupEnabled) + d.Set("storage_mb", storage.StorageMB) + } - // the basic does not support threat detection policies - if tier == mysql.GeneralPurpose || tier == mysql.MemoryOptimized { - secResp, err := securityClient.Get(ctx, id.ResourceGroup, id.Name) - if err != nil && !utils.ResponseWasNotFound(secResp.Response) { - return fmt.Errorf("retrieving Security Alert Policy for %s: %+v", *id, err) + // Computed + d.Set("fqdn", props.FullyQualifiedDomainName) } - if !utils.ResponseWasNotFound(secResp.Response) { - block := flattenSecurityAlertPolicy(secResp.SecurityAlertPolicyProperties, d.Get("threat_detection_policy.0.storage_account_access_key").(string)) - if err := d.Set("threat_detection_policy", block); err != nil { - return fmt.Errorf("setting `threat_detection_policy`: %+v", err) + // the basic does not support threat detection policies + if tier == servers.SkuTierGeneralPurpose || tier == servers.SkuTierMemoryOptimized { + securityAlertId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + secResp, err := securityClient.Get(ctx, securityAlertId) + if err != nil && !response.WasNotFound(secResp.HttpResponse) { + return fmt.Errorf("retrieving Security Alert Policy for %s: %+v", *id, err) + } + + if !response.WasNotFound(secResp.HttpResponse) && secResp.Model != nil { + block := flattenSecurityAlertPolicy(secResp.Model.Properties, d.Get("threat_detection_policy.0.storage_account_access_key").(string)) + if err := d.Set("threat_detection_policy", block); err != nil { + return fmt.Errorf("setting `threat_detection_policy`: %+v", err) + } } } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceMySqlServerDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServersClient + client := meta.(*clients.Client).MySQL.MySqlClient.Servers ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return fmt.Errorf("parsing MySQL Server ID : %v", err) } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting MySQL Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of MySQL Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandServerSkuName(skuName string) (*mysql.Sku, error) { +func expandServerSkuName(skuName string) (*servers.Sku, error) { parts := strings.Split(skuName, "_") if len(parts) != 3 { return nil, fmt.Errorf("sku_name (%s) has the worng numberof parts (%d) after splitting on _", skuName, len(parts)) } - var tier mysql.SkuTier + var tier servers.SkuTier switch parts[0] { case "B": - tier = mysql.Basic + tier = servers.SkuTierBasic case "GP": - tier = mysql.GeneralPurpose + tier = servers.SkuTierGeneralPurpose case "MO": - tier = mysql.MemoryOptimized + tier = servers.SkuTierMemoryOptimized default: return nil, fmt.Errorf("sku_name %s has unknown sku tier %s", skuName, parts[0]) } @@ -710,44 +685,44 @@ func expandServerSkuName(skuName string) (*mysql.Sku, error) { return nil, fmt.Errorf("cannot convert skuname %s capcity %s to int", skuName, parts[2]) } - return &mysql.Sku{ - Name: utils.String(skuName), - Tier: tier, - Capacity: utils.Int32(int32(capacity)), + return &servers.Sku{ + Name: skuName, + Tier: pointer.To(tier), + Capacity: utils.Int64(int64(capacity)), Family: utils.String(parts[1]), }, nil } -func expandMySQLStorageProfile(d *pluginsdk.ResourceData) *mysql.StorageProfile { - storage := mysql.StorageProfile{} +func expandMySQLStorageProfile(d *pluginsdk.ResourceData) *servers.StorageProfile { + storage := servers.StorageProfile{} // now override whatever we may have from the block with the top level properties if v, ok := d.GetOk("auto_grow_enabled"); ok { - storage.StorageAutogrow = mysql.StorageAutogrowDisabled + storage.StorageAutogrow = pointer.To(servers.StorageAutogrowDisabled) if v.(bool) { - storage.StorageAutogrow = mysql.StorageAutogrowEnabled + storage.StorageAutogrow = pointer.To(servers.StorageAutogrowEnabled) } } if v, ok := d.GetOk("backup_retention_days"); ok { - storage.BackupRetentionDays = utils.Int32(int32(v.(int))) + storage.BackupRetentionDays = utils.Int64(int64(v.(int))) } if v, ok := d.GetOk("geo_redundant_backup_enabled"); ok { - storage.GeoRedundantBackup = mysql.Disabled + storage.GeoRedundantBackup = pointer.To(servers.GeoRedundantBackupDisabled) if v.(bool) { - storage.GeoRedundantBackup = mysql.Enabled + storage.GeoRedundantBackup = pointer.To(servers.GeoRedundantBackupEnabled) } } if v, ok := d.GetOk("storage_mb"); ok { - storage.StorageMB = utils.Int32(int32(v.(int))) + storage.StorageMB = utils.Int64(int64(v.(int))) } return &storage } -func expandSecurityAlertPolicy(i interface{}) *mysql.ServerSecurityAlertPolicy { +func expandSecurityAlertPolicy(i interface{}) *serversecurityalertpolicies.ServerSecurityAlertPolicy { slice := i.([]interface{}) if len(slice) == 0 { return nil @@ -755,12 +730,12 @@ func expandSecurityAlertPolicy(i interface{}) *mysql.ServerSecurityAlertPolicy { block := slice[0].(map[string]interface{}) - state := mysql.ServerSecurityAlertPolicyStateEnabled + state := serversecurityalertpolicies.ServerSecurityAlertPolicyStateEnabled if !block["enabled"].(bool) { - state = mysql.ServerSecurityAlertPolicyStateDisabled + state = serversecurityalertpolicies.ServerSecurityAlertPolicyStateDisabled } - props := &mysql.SecurityAlertPolicyProperties{ + props := &serversecurityalertpolicies.SecurityAlertPolicyProperties{ State: state, } @@ -777,7 +752,7 @@ func expandSecurityAlertPolicy(i interface{}) *mysql.ServerSecurityAlertPolicy { } if v, ok := block["retention_days"]; ok { - props.RetentionDays = utils.Int32(int32(v.(int))) + props.RetentionDays = utils.Int64(int64(v.(int))) } if v, ok := block["storage_account_access_key"]; ok && v.(string) != "" { @@ -788,12 +763,12 @@ func expandSecurityAlertPolicy(i interface{}) *mysql.ServerSecurityAlertPolicy { props.StorageEndpoint = utils.String(v.(string)) } - return &mysql.ServerSecurityAlertPolicy{ - SecurityAlertPolicyProperties: props, + return &serversecurityalertpolicies.ServerSecurityAlertPolicy{ + Properties: props, } } -func flattenSecurityAlertPolicy(props *mysql.SecurityAlertPolicyProperties, accessKey string) interface{} { +func flattenSecurityAlertPolicy(props *serversecurityalertpolicies.SecurityAlertPolicyProperties, accessKey string) interface{} { if props == nil { return nil } @@ -805,13 +780,13 @@ func flattenSecurityAlertPolicy(props *mysql.SecurityAlertPolicyProperties, acce props.StorageEndpoint != nil && *props.StorageEndpoint == "" && props.RetentionDays != nil && *props.RetentionDays == 0 && props.EmailAccountAdmins != nil && !*props.EmailAccountAdmins && - props.State == mysql.ServerSecurityAlertPolicyStateDisabled { + props.State == serversecurityalertpolicies.ServerSecurityAlertPolicyStateDisabled { return nil } block := map[string]interface{}{} - block["enabled"] = props.State == mysql.ServerSecurityAlertPolicyStateEnabled + block["enabled"] = props.State == serversecurityalertpolicies.ServerSecurityAlertPolicyStateEnabled // the service will return "disabledAlerts":[""] for empty if props.DisabledAlerts == nil || len(*props.DisabledAlerts) == 0 || (*props.DisabledAlerts)[0] == "" { @@ -841,36 +816,3 @@ func flattenSecurityAlertPolicy(props *mysql.SecurityAlertPolicyProperties, acce return []interface{}{block} } - -func expandServerIdentity(input []interface{}) (*mysql.ResourceIdentity, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - if expanded.Type == identity.TypeNone { - return nil, nil - } - - return &mysql.ResourceIdentity{ - Type: mysql.IdentityType(string(expanded.Type)), - }, nil -} - -func flattenServerIdentity(input *mysql.ResourceIdentity) []interface{} { - var transition *identity.SystemAssigned - - if input != nil { - transition = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), - } - if input.PrincipalID != nil { - transition.PrincipalId = input.PrincipalID.String() - } - if input.TenantID != nil { - transition.TenantId = input.TenantID.String() - } - } - - return identity.FlattenSystemAssigned(transition) -} diff --git a/internal/services/mysql/mysql_server_resource_test.go b/internal/services/mysql/mysql_server_resource_test.go index 4a8075f44ce2..195b226ef480 100644 --- a/internal/services/mysql/mysql_server_resource_test.go +++ b/internal/services/mysql/mysql_server_resource_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -232,17 +232,17 @@ func TestAccMySQLServer_infrastructureEncryption(t *testing.T) { } func (t MySQLServerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ServerID(state.ID) + id, err := servers.ParseServerID(state.ID) if err != nil { return nil, err } - resp, err := clients.MySQL.ServersClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.MySQL.MySqlClient.Servers.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading MySQL Server (%s): %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (MySQLServerResource) basic(data acceptance.TestData, version string) string { diff --git a/internal/services/mysql/parse/server.go b/internal/services/mysql/parse/server.go deleted file mode 100644 index d7ce3981721b..000000000000 --- a/internal/services/mysql/parse/server.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewServerID(subscriptionId, resourceGroup, name string) ServerId { - return ServerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ServerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Server", segmentsStr) -} - -func (id ServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ServerID parses a Server ID into an ServerId struct -func ServerID(input string) (*ServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an Server ID: %+v", input, err) - } - - resourceId := ServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("servers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ServerIDInsensitively parses an Server ID into an ServerId struct, insensitively -// This should only be used to parse an ID for rewriting, the ServerID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ServerIDInsensitively(input string) (*ServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'servers' segment - serversKey := "servers" - for key := range id.Path { - if strings.EqualFold(key, serversKey) { - serversKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(serversKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/mysql/parse/server_test.go b/internal/services/mysql/parse/server_test.go deleted file mode 100644 index 6982e68f50ee..000000000000 --- a/internal/services/mysql/parse/server_test.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ServerId{} - -func TestServerIDFormatter(t *testing.T) { - actual := NewServerID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestServerID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ServerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1", - Expected: &ServerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "server1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ServerID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} - -func TestServerIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ServerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1", - Expected: &ServerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "server1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1", - Expected: &ServerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "server1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/SERVERS/server1", - Expected: &ServerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "server1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/SeRvErS/server1", - Expected: &ServerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "server1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ServerIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index 3069e7fac96d..86feee819a46 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -6,5 +6,4 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/administrators/activeDirectory //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerAzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/server1/administrators/ActiveDirectory -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Server -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1 diff --git a/internal/services/mysql/validate/server_id.go b/internal/services/mysql/validate/server_id.go deleted file mode 100644 index 480ed5efaabc..000000000000 --- a/internal/services/mysql/validate/server_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" -) - -func ServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ServerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/mysql/validate/server_id_test.go b/internal/services/mysql/validate/server_id_test.go deleted file mode 100644 index c5bcd2b9ba6d..000000000000 --- a/internal/services/mysql/validate/server_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestServerID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ServerID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/network/private_endpoint_resource.go b/internal/services/network/private_endpoint_resource.go index 0d11a0bb56bf..dd46f2a19d4e 100644 --- a/internal/services/network/private_endpoint_resource.go +++ b/internal/services/network/private_endpoint_resource.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" mariadbServers "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-04-01/privateendpoints" postgresqlServers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2020-06-01/privatezones" @@ -27,7 +28,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" cosmosParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/parse" - mysqlParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -1157,7 +1157,7 @@ func normalizePrivateConnectionId(privateConnectionId string) string { } } if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformysql") { - if serverId, err := mysqlParse.ServerIDInsensitively(privateConnectionId); err == nil { + if serverId, err := servers.ParseServerIDInsensitively(privateConnectionId); err == nil { privateConnectionId = serverId.ID() } } diff --git a/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go b/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go index e09cb7790737..d8283a1e2677 100644 --- a/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go +++ b/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go @@ -8,9 +8,9 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - mysqlValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate" @@ -69,7 +69,7 @@ func resourceSpringCloudAppMysqlAssociation() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: mysqlValidate.ServerID, + ValidateFunc: servers.ValidateServerID, }, "database_name": { From 32166ae2f6e0b1675299fc377ff9457fe21a4fa7 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 16:15:30 -0700 Subject: [PATCH 05/12] swap azurerm_mysql_server_key to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 40 ++--- .../mysql/mysql_server_key_resource.go | 64 ++++---- .../mysql/mysql_server_key_resource_test.go | 8 +- internal/services/mysql/parse/key.go | 78 ---------- internal/services/mysql/parse/key_test.go | 131 ---------------- internal/services/mysql/resourceids.go | 1 - internal/services/mysql/validate/key_id.go | 26 ---- .../services/mysql/validate/key_id_test.go | 91 ------------ .../mysql/2020-01-01/client.go | 55 +++++++ .../mysql/2020-01-01/serverkeys/README.md | 82 ++++++++++ .../mysql/2020-01-01/serverkeys/client.go | 26 ++++ .../mysql/2020-01-01/serverkeys/constants.go | 48 ++++++ .../mysql/2020-01-01/serverkeys/id_key.go | 140 ++++++++++++++++++ .../mysql/2020-01-01/serverkeys/id_server.go | 127 ++++++++++++++++ .../serverkeys/method_createorupdate.go | 74 +++++++++ .../2020-01-01/serverkeys/method_delete.go | 71 +++++++++ .../mysql/2020-01-01/serverkeys/method_get.go | 51 +++++++ .../2020-01-01/serverkeys/method_list.go | 89 +++++++++++ .../2020-01-01/serverkeys/model_serverkey.go | 12 ++ .../serverkeys/model_serverkeyproperties.go | 28 ++++ .../mysql/2020-01-01/serverkeys/predicates.go | 32 ++++ .../mysql/2020-01-01/serverkeys/version.go | 12 ++ .../mysql/2020-01-01/serverstart/client.go | 26 ++++ .../mysql/2020-01-01/serverstart/id_server.go | 127 ++++++++++++++++ .../serverstart/method_serversstart.go | 70 +++++++++ .../mysql/2020-01-01/serverstart/version.go | 12 ++ .../mysql/2020-01-01/serverstop/client.go | 26 ++++ .../mysql/2020-01-01/serverstop/id_server.go | 127 ++++++++++++++++ .../serverstop/method_serversstop.go | 70 +++++++++ .../mysql/2020-01-01/serverstop/version.go | 12 ++ .../mysql/2020-01-01/serverupgrade/README.md | 37 +++++ .../mysql/2020-01-01/serverupgrade/client.go | 26 ++++ .../2020-01-01/serverupgrade/id_server.go | 127 ++++++++++++++++ .../serverupgrade/method_serversupgrade.go | 74 +++++++++ .../model_serverupgradeparameters.go | 8 + ...model_serverupgradeparametersproperties.go | 8 + .../mysql/2020-01-01/serverupgrade/version.go | 12 ++ vendor/modules.txt | 5 + 38 files changed, 1668 insertions(+), 385 deletions(-) delete mode 100644 internal/services/mysql/parse/key.go delete mode 100644 internal/services/mysql/parse/key_test.go delete mode 100644 internal/services/mysql/validate/key_id.go delete mode 100644 internal/services/mysql/validate/key_id_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_key.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkey.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkeyproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/method_serversstart.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/method_serversstop.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/method_serversupgrade.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparametersproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/version.go diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index c33328bfdd7c..64aa2b53c06b 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -8,6 +8,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck servers_v2017_12_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01" + servers_v2020_01_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01" flexibleServers_v2021_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/azureadadministrators" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" @@ -15,13 +16,12 @@ import ( ) type Client struct { - FlexibleServers *flexibleServers_v2021_05_01.Client - MySqlClient *servers_v2017_12_01.Client + FlexibleServers *flexibleServers_v2021_05_01.Client + MySqlClient *servers_v2017_12_01.Client + ServerKeysClient *servers_v2020_01_01.Client - ServerKeysClient *mysql.ServerKeysClient - ServerSecurityAlertPoliciesClient *mysql.ServerSecurityAlertPoliciesClient - VirtualNetworkRulesClient *mysql.VirtualNetworkRulesClient - ServerAdministratorsClient *mysql.ServerAdministratorsClient + VirtualNetworkRulesClient *mysql.VirtualNetworkRulesClient + ServerAdministratorsClient *mysql.ServerAdministratorsClient // TODO: port over to using the Meta Client (which involves bumping the API Version) AzureADAdministratorsClient *azureadadministrators.AzureADAdministratorsClient @@ -42,17 +42,18 @@ func NewClient(o *common.ClientOptions) (*Client, error) { return nil, fmt.Errorf("building MySql client: %+v", err) } + serverKeysClient, err := servers_v2020_01_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building MySql client: %+v", err) + } + azureADAdministratorsClient, err := azureadadministrators.NewAzureADAdministratorsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { return nil, fmt.Errorf("building Azure AD Administrators client: %+v", err) } - o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) - - ServerKeysClient := mysql.NewServerKeysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ServerKeysClient.Client, o.ResourceManagerAuthorizer) - - serverSecurityAlertPoliciesClient := mysql.NewServerSecurityAlertPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&serverSecurityAlertPoliciesClient.Client, o.ResourceManagerAuthorizer) + o.Configure(azureADAdministgratorsClient.Client, o.Authorizers.ResourceManager) VirtualNetworkRulesClient := mysql.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&VirtualNetworkRulesClient.Client, o.ResourceManagerAuthorizer) @@ -61,14 +62,13 @@ func NewClient(o *common.ClientOptions) (*Client, error) { o.ConfigureClient(&serverAdministratorsClient.Client, o.ResourceManagerAuthorizer) return &Client{ - FlexibleServers: flexibleServersMetaClient, - MySqlClient: mySqlMetaClient, + FlexibleServers: flexibleServersMetaClient, + MySqlClient: mySqlMetaClient, + ServerKeysClient: serverKeysClient, // TODO: switch to using the Meta Clients - AzureADAdministratorsClient: azureADAdministratorsClient, - ServerKeysClient: &ServerKeysClient, - ServerSecurityAlertPoliciesClient: &serverSecurityAlertPoliciesClient, - VirtualNetworkRulesClient: &VirtualNetworkRulesClient, - ServerAdministratorsClient: &serverAdministratorsClient, + AzureADAdministratorsClient: azureADAdministratorsClient, + VirtualNetworkRulesClient: &VirtualNetworkRulesClient, + ServerAdministratorsClient: &serverAdministratorsClient, }, nil } diff --git a/internal/services/mysql/mysql_server_key_resource.go b/internal/services/mysql/mysql_server_key_resource.go index bd42af7c16e6..55a84c8cfd12 100644 --- a/internal/services/mysql/mysql_server_key_resource.go +++ b/internal/services/mysql/mysql_server_key_resource.go @@ -9,16 +9,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/client" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" resourcesClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -33,7 +33,7 @@ func resourceMySQLServerKey() *pluginsdk.Resource { Delete: resourceMySQLServerKeyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.KeyID(id) + _, err := serverkeys.ParseKeyID(id) return err }), @@ -78,13 +78,13 @@ func getMySQLServerKeyName(ctx context.Context, keyVaultsClient *client.Client, } func resourceMySQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - keysClient := meta.(*clients.Client).MySQL.ServerKeysClient + keysClient := meta.(*clients.Client).MySQL.ServerKeysClient.ServerKeys keyVaultsClient := meta.(*clients.Client).KeyVault resourcesClient := meta.(*clients.Client).Resource ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - serverID, err := servers.ParseServerID(d.Get("server_id").(string)) + serverID, err := serverkeys.ParseServerID(d.Get("server_id").(string)) if err != nil { return err } @@ -96,20 +96,23 @@ func resourceMySQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta interfac // This resource is a singleton, but its name can be anything. // If you create a new key with different name with the old key, the service will not give you any warning but directly replace the old key with the new key. // Therefore sometimes you cannot get the old key using the GET API since you may not know the name of the old key - resp, err := keysClient.List(ctx, serverID.ResourceGroupName, serverID.ServerName) + resp, err := keysClient.List(ctx, *serverID) if err != nil { return fmt.Errorf("listing existing MySQL Server Keys in %s", serverID, err) } - keys := resp.Values() + if resp.Model == nil { + return fmt.Errorf("model was nil for %s", serverID) + } + keys := *resp.Model if len(keys) > 0 { if len(keys) > 1 { return fmt.Errorf("expecting at most one MySQL Server Key, but got %q", len(keys)) } - if keys[0].ID == nil || *keys[0].ID == "" { + if keys[0].Id == nil || *keys[0].Id == "" { return fmt.Errorf("missing ID for existing MySQL Server Key") } - id, err := parse.KeyID(*keys[0].ID) + id, err := serverkeys.ParseKeyID(*keys[0].Id) if err != nil { return err } @@ -124,39 +127,35 @@ func resourceMySQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("cannot compose name for MySQL Server Key (Resource Group %q / Server %q): %+v", serverID.ResourceGroupName, serverID.ServerName, err) } - id := parse.NewKeyID(serverID.SubscriptionId, serverID.ResourceGroupName, serverID.ServerName, *name) - param := mysql.ServerKey{ - ServerKeyProperties: &mysql.ServerKeyProperties{ - ServerKeyType: utils.String("AzureKeyVault"), - URI: &keyVaultKeyURI, + id := serverkeys.NewKeyID(serverID.SubscriptionId, serverID.ResourceGroupName, serverID.ServerName, *name) + param := serverkeys.ServerKey{ + Properties: &serverkeys.ServerKeyProperties{ + ServerKeyType: serverkeys.ServerKeyTypeAzureKeyVault, + Uri: &keyVaultKeyURI, }, } - future, err := keysClient.CreateOrUpdate(ctx, id.ServerName, id.Name, param, id.ResourceGroup) - if err != nil { + if err = keysClient.CreateOrUpdateThenPoll(ctx, id, param); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, keysClient.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } d.SetId(id.ID()) return resourceMySQLServerKeyRead(d, meta) } func resourceMySQLServerKeyRead(d *pluginsdk.ResourceData, meta interface{}) error { - keysClient := meta.(*clients.Client).MySQL.ServerKeysClient + keysClient := meta.(*clients.Client).MySQL.ServerKeysClient.ServerKeys ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.KeyID(d.Id()) + id, err := serverkeys.ParseKeyID(d.Id()) if err != nil { return err } - resp, err := keysClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := keysClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -165,21 +164,23 @@ func resourceMySQLServerKeyRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("retrieving %s: %+v", *id, err) } - serverId := servers.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) + serverId := servers.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) d.Set("server_id", serverId.ID()) - if props := resp.ServerKeyProperties; props != nil { - d.Set("key_vault_key_id", props.URI) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("key_vault_key_id", props.Uri) + } } return nil } func resourceMySQLServerKeyDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServerKeysClient + client := meta.(*clients.Client).MySQL.ServerKeysClient.ServerKeys ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.KeyID(d.Id()) + id, err := serverkeys.ParseKeyID(d.Id()) if err != nil { return err } @@ -187,14 +188,9 @@ func resourceMySQLServerKeyDelete(d *pluginsdk.ResourceData, meta interface{}) e locks.ByName(id.ServerName, mySQLServerResourceName) defer locks.UnlockByName(id.ServerName, mySQLServerResourceName) - future, err := client.Delete(ctx, id.ServerName, id.Name, id.ResourceGroup) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/mysql/mysql_server_key_resource_test.go b/internal/services/mysql/mysql_server_key_resource_test.go index 5e9d1eb5d1e5..22b557e8c54e 100644 --- a/internal/services/mysql/mysql_server_key_resource_test.go +++ b/internal/services/mysql/mysql_server_key_resource_test.go @@ -8,10 +8,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -70,17 +70,17 @@ func TestAccMySQLServerKey_requiresImport(t *testing.T) { } func (t MySQLServerKeyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.KeyID(state.ID) + id, err := serverkeys.ParseKeyID(state.ID) if err != nil { return nil, err } - resp, err := clients.MySQL.ServerKeysClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := clients.MySQL.ServerKeysClient.ServerKeys.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading MySQL Server Key (%s): %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (MySQLServerKeyResource) template(data acceptance.TestData) string { diff --git a/internal/services/mysql/parse/key.go b/internal/services/mysql/parse/key.go deleted file mode 100644 index 33f7df3bef82..000000000000 --- a/internal/services/mysql/parse/key.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type KeyId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewKeyID(subscriptionId, resourceGroup, serverName, name string) KeyId { - return KeyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id KeyId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Key", segmentsStr) -} - -func (id KeyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/keys/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// KeyID parses a Key ID into an KeyId struct -func KeyID(input string) (*KeyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an Key ID: %+v", input, err) - } - - resourceId := KeyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("keys"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/mysql/parse/key_test.go b/internal/services/mysql/parse/key_test.go deleted file mode 100644 index 03e4e08651dc..000000000000 --- a/internal/services/mysql/parse/key_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = KeyId{} - -func TestKeyIDFormatter(t *testing.T) { - actual := NewKeyID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "key1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestKeyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *KeyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1", - Expected: &KeyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ServerName: "server1", - Name: "key1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/KEYS/KEY1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := KeyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ServerName != v.Expected.ServerName { - t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index 86feee819a46..bdc25c9284d8 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -4,6 +4,5 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/administrators/activeDirectory -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerAzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/server1/administrators/ActiveDirectory //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1 diff --git a/internal/services/mysql/validate/key_id.go b/internal/services/mysql/validate/key_id.go deleted file mode 100644 index 1591dc936014..000000000000 --- a/internal/services/mysql/validate/key_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" -) - -func KeyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.KeyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/mysql/validate/key_id_test.go b/internal/services/mysql/validate/key_id_test.go deleted file mode 100644 index 88a157eaf272..000000000000 --- a/internal/services/mysql/validate/key_id_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestKeyID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Valid: false, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/KEYS/KEY1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := KeyID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/client.go new file mode 100644 index 000000000000..07b075e137b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/client.go @@ -0,0 +1,55 @@ +package v2020_01_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + ServerKeys *serverkeys.ServerKeysClient + ServerStart *serverstart.ServerStartClient + ServerStop *serverstop.ServerStopClient + ServerUpgrade *serverupgrade.ServerUpgradeClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + serverKeysClient, err := serverkeys.NewServerKeysClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerKeys client: %+v", err) + } + configureFunc(serverKeysClient.Client) + + serverStartClient, err := serverstart.NewServerStartClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerStart client: %+v", err) + } + configureFunc(serverStartClient.Client) + + serverStopClient, err := serverstop.NewServerStopClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerStop client: %+v", err) + } + configureFunc(serverStopClient.Client) + + serverUpgradeClient, err := serverupgrade.NewServerUpgradeClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ServerUpgrade client: %+v", err) + } + configureFunc(serverUpgradeClient.Client) + + return &Client{ + ServerKeys: serverKeysClient, + ServerStart: serverStartClient, + ServerStop: serverStopClient, + ServerUpgrade: serverUpgradeClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/README.md new file mode 100644 index 000000000000..1c69991081e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys` Documentation + +The `serverkeys` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2020-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys" +``` + + +### Client Initialization + +```go +client := serverkeys.NewServerKeysClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerKeysClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := serverkeys.NewKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "keyValue") + +payload := serverkeys.ServerKey{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerKeysClient.Delete` + +```go +ctx := context.TODO() +id := serverkeys.NewKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "keyValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerKeysClient.Get` + +```go +ctx := context.TODO() +id := serverkeys.NewKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "keyValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServerKeysClient.List` + +```go +ctx := context.TODO() +id := serverkeys.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/client.go new file mode 100644 index 000000000000..83970b7eb35d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/client.go @@ -0,0 +1,26 @@ +package serverkeys + +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 ServerKeysClient struct { + Client *resourcemanager.Client +} + +func NewServerKeysClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serverkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerKeysClient: %+v", err) + } + + return &ServerKeysClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/constants.go new file mode 100644 index 000000000000..15e01555d464 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/constants.go @@ -0,0 +1,48 @@ +package serverkeys + +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. + +type ServerKeyType string + +const ( + ServerKeyTypeAzureKeyVault ServerKeyType = "AzureKeyVault" +) + +func PossibleValuesForServerKeyType() []string { + return []string{ + string(ServerKeyTypeAzureKeyVault), + } +} + +func (s *ServerKeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerKeyType(input string) (*ServerKeyType, error) { + vals := map[string]ServerKeyType{ + "azurekeyvault": ServerKeyTypeAzureKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerKeyType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_key.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_key.go new file mode 100644 index 000000000000..1ce5b0508169 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_key.go @@ -0,0 +1,140 @@ +package serverkeys + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = KeyId{} + +// KeyId is a struct representing the Resource ID for a Key +type KeyId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + KeyName string +} + +// NewKeyID returns a new KeyId struct +func NewKeyID(subscriptionId string, resourceGroupName string, serverName string, keyName string) KeyId { + return KeyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + KeyName: keyName, + } +} + +// ParseKeyID parses 'input' into a KeyId +func ParseKeyID(input string) (*KeyId, error) { + parser := resourceids.NewParserFromResourceIdType(KeyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KeyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + } + + return &id, nil +} + +// ParseKeyIDInsensitively parses 'input' case-insensitively into a KeyId +// note: this method should only be used for API response data and not user input +func ParseKeyIDInsensitively(input string) (*KeyId, error) { + parser := resourceids.NewParserFromResourceIdType(KeyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KeyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + } + + return &id, nil +} + +// ValidateKeyID checks that 'input' can be parsed as a Key ID +func ValidateKeyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseKeyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Key ID +func (id KeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/keys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.KeyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Key ID +func (id KeyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticKeys", "keys", "keys"), + resourceids.UserSpecifiedSegment("keyName", "keyValue"), + } +} + +// String returns a human-readable description of this Key ID +func (id KeyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Key Name: %q", id.KeyName), + } + return fmt.Sprintf("Key (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_server.go new file mode 100644 index 000000000000..cd6654c4b9fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/id_server.go @@ -0,0 +1,127 @@ +package serverkeys + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_createorupdate.go new file mode 100644 index 000000000000..8ee27f3496c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_createorupdate.go @@ -0,0 +1,74 @@ +package serverkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ServerKeysClient) CreateOrUpdate(ctx context.Context, id KeyId, input ServerKey) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ServerKeysClient) CreateOrUpdateThenPoll(ctx context.Context, id KeyId, input ServerKey) 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/mysql/2020-01-01/serverkeys/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_delete.go new file mode 100644 index 000000000000..29eafab24a1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_delete.go @@ -0,0 +1,71 @@ +package serverkeys + +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 ServerKeysClient) Delete(ctx context.Context, id KeyId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServerKeysClient) DeleteThenPoll(ctx context.Context, id KeyId) 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/mysql/2020-01-01/serverkeys/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_get.go new file mode 100644 index 000000000000..b5d147885c74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_get.go @@ -0,0 +1,51 @@ +package serverkeys + +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 *ServerKey +} + +// Get ... +func (c ServerKeysClient) Get(ctx context.Context, id KeyId) (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/mysql/2020-01-01/serverkeys/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_list.go new file mode 100644 index 000000000000..ac2918db3c44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/method_list.go @@ -0,0 +1,89 @@ +package serverkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ServerKey +} + +type ListCompleteResult struct { + Items []ServerKey +} + +// List ... +func (c ServerKeysClient) List(ctx context.Context, id ServerId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/keys", 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 *[]ServerKey `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 ServerKeysClient) ListComplete(ctx context.Context, id ServerId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ServerKeyOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ServerKeysClient) ListCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate ServerKeyOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ServerKey, 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{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkey.go new file mode 100644 index 000000000000..b73a7026168e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkey.go @@ -0,0 +1,12 @@ +package serverkeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKey struct { + Id *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ServerKeyProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkeyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkeyproperties.go new file mode 100644 index 000000000000..5b4fe33315f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/model_serverkeyproperties.go @@ -0,0 +1,28 @@ +package serverkeys + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKeyProperties struct { + CreationDate *string `json:"creationDate,omitempty"` + ServerKeyType ServerKeyType `json:"serverKeyType"` + Uri *string `json:"uri,omitempty"` +} + +func (o *ServerKeyProperties) GetCreationDateAsTime() (*time.Time, error) { + if o.CreationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerKeyProperties) SetCreationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/predicates.go new file mode 100644 index 000000000000..0946941bd878 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/predicates.go @@ -0,0 +1,32 @@ +package serverkeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKeyOperationPredicate struct { + Id *string + Kind *string + Name *string + Type *string +} + +func (p ServerKeyOperationPredicate) Matches(input ServerKey) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil || *p.Kind != *input.Kind) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/version.go new file mode 100644 index 000000000000..0155b1ec7962 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys/version.go @@ -0,0 +1,12 @@ +package serverkeys + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverkeys/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/client.go new file mode 100644 index 000000000000..8522b2703245 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/client.go @@ -0,0 +1,26 @@ +package serverstart + +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 ServerStartClient struct { + Client *resourcemanager.Client +} + +func NewServerStartClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerStartClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serverstart", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerStartClient: %+v", err) + } + + return &ServerStartClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/id_server.go new file mode 100644 index 000000000000..fd31671afb95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/id_server.go @@ -0,0 +1,127 @@ +package serverstart + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/method_serversstart.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/method_serversstart.go new file mode 100644 index 000000000000..8697c8d1d037 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/method_serversstart.go @@ -0,0 +1,70 @@ +package serverstart + +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 ServersStartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServersStart ... +func (c ServerStartClient) ServersStart(ctx context.Context, id ServerId) (result ServersStartOperationResponse, 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()), + } + + 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 +} + +// ServersStartThenPoll performs ServersStart then polls until it's completed +func (c ServerStartClient) ServersStartThenPoll(ctx context.Context, id ServerId) error { + result, err := c.ServersStart(ctx, id) + if err != nil { + return fmt.Errorf("performing ServersStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServersStart: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/version.go new file mode 100644 index 000000000000..674855e4cf93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart/version.go @@ -0,0 +1,12 @@ +package serverstart + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverstart/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/client.go new file mode 100644 index 000000000000..1646d43a0057 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/client.go @@ -0,0 +1,26 @@ +package serverstop + +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 ServerStopClient struct { + Client *resourcemanager.Client +} + +func NewServerStopClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerStopClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serverstop", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerStopClient: %+v", err) + } + + return &ServerStopClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/id_server.go new file mode 100644 index 000000000000..fe255126afdb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/id_server.go @@ -0,0 +1,127 @@ +package serverstop + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/method_serversstop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/method_serversstop.go new file mode 100644 index 000000000000..93d1400669ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/method_serversstop.go @@ -0,0 +1,70 @@ +package serverstop + +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 ServersStopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServersStop ... +func (c ServerStopClient) ServersStop(ctx context.Context, id ServerId) (result ServersStopOperationResponse, 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()), + } + + 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 +} + +// ServersStopThenPoll performs ServersStop then polls until it's completed +func (c ServerStopClient) ServersStopThenPoll(ctx context.Context, id ServerId) error { + result, err := c.ServersStop(ctx, id) + if err != nil { + return fmt.Errorf("performing ServersStop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServersStop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/version.go new file mode 100644 index 000000000000..9c1dd6c6a112 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop/version.go @@ -0,0 +1,12 @@ +package serverstop + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverstop/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/README.md new file mode 100644 index 000000000000..2b9671318514 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade` Documentation + +The `serverupgrade` SDK allows for interaction with the Azure Resource Manager Service `mysql` (API Version `2020-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade" +``` + + +### Client Initialization + +```go +client := serverupgrade.NewServerUpgradeClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerUpgradeClient.ServersUpgrade` + +```go +ctx := context.TODO() +id := serverupgrade.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := serverupgrade.ServerUpgradeParameters{ + // ... +} + + +if err := client.ServersUpgradeThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/client.go new file mode 100644 index 000000000000..907f91bce781 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/client.go @@ -0,0 +1,26 @@ +package serverupgrade + +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 ServerUpgradeClient struct { + Client *resourcemanager.Client +} + +func NewServerUpgradeClientWithBaseURI(sdkApi sdkEnv.Api) (*ServerUpgradeClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "serverupgrade", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ServerUpgradeClient: %+v", err) + } + + return &ServerUpgradeClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go new file mode 100644 index 000000000000..db03967b9b78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go @@ -0,0 +1,127 @@ +package serverupgrade + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/method_serversupgrade.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/method_serversupgrade.go new file mode 100644 index 000000000000..10443cff8937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/method_serversupgrade.go @@ -0,0 +1,74 @@ +package serverupgrade + +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 ServersUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServersUpgrade ... +func (c ServerUpgradeClient) ServersUpgrade(ctx context.Context, id ServerId, input ServerUpgradeParameters) (result ServersUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgrade", 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 +} + +// ServersUpgradeThenPoll performs ServersUpgrade then polls until it's completed +func (c ServerUpgradeClient) ServersUpgradeThenPoll(ctx context.Context, id ServerId, input ServerUpgradeParameters) error { + result, err := c.ServersUpgrade(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServersUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServersUpgrade: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparameters.go new file mode 100644 index 000000000000..b5d94fcc9cba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparameters.go @@ -0,0 +1,8 @@ +package serverupgrade + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpgradeParameters struct { + Properties *ServerUpgradeParametersProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparametersproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparametersproperties.go new file mode 100644 index 000000000000..88c62306ab1d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/model_serverupgradeparametersproperties.go @@ -0,0 +1,8 @@ +package serverupgrade + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpgradeParametersProperties struct { + TargetServerVersion *string `json:"targetServerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/version.go new file mode 100644 index 000000000000..8783a2fb4b9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade/version.go @@ -0,0 +1,12 @@ +package serverupgrade + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverupgrade/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index c236d9ae445f..703d6568f5be 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -508,6 +508,11 @@ github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serverrestar github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serversecurityalertpolicies github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01 +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverkeys +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstart +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverstop +github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01/serverupgrade github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01 github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/backups github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/checknameavailability From 26e3e5e5d51b9ea751112fe6d681db178b204240 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 16:32:47 -0700 Subject: [PATCH 06/12] swap azurerm_mysql_virtual_network_rule to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 7 +- .../mysql_virtual_network_rule_resource.go | 73 +++++----- ...ysql_virtual_network_rule_resource_test.go | 17 +-- .../mysql/parse/virtual_network_rule.go | 78 ----------- .../mysql/parse/virtual_network_rule_test.go | 131 ------------------ internal/services/mysql/resourceids.go | 1 - .../mysql/validate/virtual_network_rule_id.go | 26 ---- .../validate/virtual_network_rule_id_test.go | 91 ------------ 8 files changed, 43 insertions(+), 381 deletions(-) delete mode 100644 internal/services/mysql/parse/virtual_network_rule.go delete mode 100644 internal/services/mysql/parse/virtual_network_rule_test.go delete mode 100644 internal/services/mysql/validate/virtual_network_rule_id.go delete mode 100644 internal/services/mysql/validate/virtual_network_rule_id_test.go diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index 64aa2b53c06b..742d518822f7 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -20,7 +20,6 @@ type Client struct { MySqlClient *servers_v2017_12_01.Client ServerKeysClient *servers_v2020_01_01.Client - VirtualNetworkRulesClient *mysql.VirtualNetworkRulesClient ServerAdministratorsClient *mysql.ServerAdministratorsClient // TODO: port over to using the Meta Client (which involves bumping the API Version) @@ -53,10 +52,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) { if err != nil { return nil, fmt.Errorf("building Azure AD Administrators client: %+v", err) } - o.Configure(azureADAdministgratorsClient.Client, o.Authorizers.ResourceManager) - - VirtualNetworkRulesClient := mysql.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&VirtualNetworkRulesClient.Client, o.ResourceManagerAuthorizer) + o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) serverAdministratorsClient := mysql.NewServerAdministratorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&serverAdministratorsClient.Client, o.ResourceManagerAuthorizer) @@ -68,7 +64,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { // TODO: switch to using the Meta Clients AzureADAdministratorsClient: azureADAdministratorsClient, - VirtualNetworkRulesClient: &VirtualNetworkRulesClient, ServerAdministratorsClient: &serverAdministratorsClient, }, nil } diff --git a/internal/services/mysql/mysql_virtual_network_rule_resource.go b/internal/services/mysql/mysql_virtual_network_rule_resource.go index f666e63e00fd..8d8b4c4c9353 100644 --- a/internal/services/mysql/mysql_virtual_network_rule_resource.go +++ b/internal/services/mysql/mysql_virtual_network_rule_resource.go @@ -9,12 +9,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -30,7 +30,7 @@ func resourceMySQLVirtualNetworkRule() *pluginsdk.Resource { Delete: resourceMySQLVirtualNetworkRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VirtualNetworkRuleID(id) + _, err := virtualnetworkrules.ParseVirtualNetworkRuleID(id) return err }), @@ -68,40 +68,37 @@ func resourceMySQLVirtualNetworkRule() *pluginsdk.Resource { } func resourceMySQLVirtualNetworkRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.VirtualNetworkRulesClient + client := meta.(*clients.Client).MySQL.MySqlClient.VirtualNetworkRules subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVirtualNetworkRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := virtualnetworkrules.NewVirtualNetworkRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mysql_virtual_network_rule", id.ID()) } } - parameters := mysql.VirtualNetworkRule{ - VirtualNetworkRuleProperties: &mysql.VirtualNetworkRuleProperties{ - VirtualNetworkSubnetID: utils.String(d.Get("subnet_id").(string)), + parameters := virtualnetworkrules.VirtualNetworkRule{ + Properties: &virtualnetworkrules.VirtualNetworkRuleProperties{ + VirtualNetworkSubnetId: d.Get("subnet_id").(string), IgnoreMissingVnetServiceEndpoint: utils.Bool(false), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } + // todo check if we need this // Wait for the provisioning state to become ready log.Printf("[DEBUG] Waiting for %s to become ready", id) stateConf := &pluginsdk.StateChangeConf{ @@ -126,18 +123,18 @@ func resourceMySQLVirtualNetworkRuleCreateUpdate(d *pluginsdk.ResourceData, meta } func resourceMySQLVirtualNetworkRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.VirtualNetworkRulesClient + client := meta.(*clients.Client).MySQL.MySqlClient.VirtualNetworkRules ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VirtualNetworkRuleID(d.Id()) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", id) d.SetId("") return nil @@ -146,43 +143,41 @@ func resourceMySQLVirtualNetworkRuleRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) + d.Set("name", id.VirtualNetworkRuleName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.VirtualNetworkRuleProperties; props != nil { - d.Set("subnet_id", props.VirtualNetworkSubnetID) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("subnet_id", props.VirtualNetworkSubnetId) + } } return nil } func resourceMySQLVirtualNetworkRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.VirtualNetworkRulesClient + client := meta.(*clients.Client).MySQL.MySqlClient.VirtualNetworkRules ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VirtualNetworkRuleID(d.Id()) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } return nil } -func mySQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client *mysql.VirtualNetworkRulesClient, id parse.VirtualNetworkRuleId) pluginsdk.StateRefreshFunc { +func mySQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client *virtualnetworkrules.VirtualNetworkRulesClient, id virtualnetworkrules.VirtualNetworkRuleId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] Retrieving %s returned 404.", id) return nil, "ResponseNotFound", nil } @@ -190,9 +185,13 @@ func mySQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client * return nil, "", fmt.Errorf("polling for the state of the %s: %+v", id, err) } - if props := resp.VirtualNetworkRuleProperties; props != nil { - log.Printf("[DEBUG] Retrieving %s returned Status %s", id, props.State) - return resp, string(props.State), nil + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + log.Printf("[DEBUG] Retrieving %s returned Status %s", id, props.State) + if props.State != nil { + return resp, string(*props.State), nil + } + } } // Valid response was returned but VirtualNetworkRuleProperties was nil. Basically the rule exists, but with no properties for some reason. Assume Unknown instead of returning error. diff --git a/internal/services/mysql/mysql_virtual_network_rule_resource_test.go b/internal/services/mysql/mysql_virtual_network_rule_resource_test.go index 9f46423ff418..0b880857fd9c 100644 --- a/internal/services/mysql/mysql_virtual_network_rule_resource_test.go +++ b/internal/services/mysql/mysql_virtual_network_rule_resource_test.go @@ -9,10 +9,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/virtualnetworkrules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -119,33 +119,28 @@ func TestAccMySQLVirtualNetworkRule_multipleSubnets(t *testing.T) { } func (r MySQLVirtualNetworkRuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.VirtualNetworkRuleID(state.ID) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(state.ID) if err != nil { return nil, err } - resp, err := clients.MySQL.VirtualNetworkRulesClient.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := clients.MySQL.MySqlClient.VirtualNetworkRules.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading MySQL Virtual Network Rule (%s): %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r MySQLVirtualNetworkRuleResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.VirtualNetworkRuleID(state.ID) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(state.ID) if err != nil { return nil, err } - future, err := client.MySQL.VirtualNetworkRulesClient.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { + if err = client.MySQL.MySqlClient.VirtualNetworkRules.DeleteThenPoll(ctx, *id); err != nil { return nil, fmt.Errorf("deleting MySQL Virtual Network Rule (%s): %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.MySQL.VirtualNetworkRulesClient.Client); err != nil { - return nil, fmt.Errorf("waiting for deletion of MySQL Virtual Network Rule (%s): %+v", id, err) - } - return utils.Bool(true), nil } diff --git a/internal/services/mysql/parse/virtual_network_rule.go b/internal/services/mysql/parse/virtual_network_rule.go deleted file mode 100644 index d6a138248e28..000000000000 --- a/internal/services/mysql/parse/virtual_network_rule.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VirtualNetworkRuleId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewVirtualNetworkRuleID(subscriptionId, resourceGroup, serverName, name string) VirtualNetworkRuleId { - return VirtualNetworkRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id VirtualNetworkRuleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Virtual Network Rule", segmentsStr) -} - -func (id VirtualNetworkRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/servers/%s/virtualNetworkRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// VirtualNetworkRuleID parses a VirtualNetworkRule ID into an VirtualNetworkRuleId struct -func VirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an VirtualNetworkRule ID: %+v", input, err) - } - - resourceId := VirtualNetworkRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("virtualNetworkRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/mysql/parse/virtual_network_rule_test.go b/internal/services/mysql/parse/virtual_network_rule_test.go deleted file mode 100644 index 179db09b6d35..000000000000 --- a/internal/services/mysql/parse/virtual_network_rule_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = VirtualNetworkRuleId{} - -func TestVirtualNetworkRuleIDFormatter(t *testing.T) { - actual := NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "server1", "virtualNetworkRule1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestVirtualNetworkRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VirtualNetworkRuleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Error: true, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1", - Expected: &VirtualNetworkRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ServerName: "server1", - Name: "virtualNetworkRule1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/VIRTUALNETWORKRULES/VIRTUALNETWORKRULE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := VirtualNetworkRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ServerName != v.Expected.ServerName { - t.Fatalf("Expected %q but got %q for ServerName", v.Expected.ServerName, actual.ServerName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index bdc25c9284d8..c35a70cd285e 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -5,4 +5,3 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/administrators/activeDirectory //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerAzureActiveDirectoryAdministrator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/server1/administrators/ActiveDirectory -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1 diff --git a/internal/services/mysql/validate/virtual_network_rule_id.go b/internal/services/mysql/validate/virtual_network_rule_id.go deleted file mode 100644 index db42f4cb5a2d..000000000000 --- a/internal/services/mysql/validate/virtual_network_rule_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" -) - -func VirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VirtualNetworkRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/mysql/validate/virtual_network_rule_id_test.go b/internal/services/mysql/validate/virtual_network_rule_id_test.go deleted file mode 100644 index 24c7fc782278..000000000000 --- a/internal/services/mysql/validate/virtual_network_rule_id_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestVirtualNetworkRuleID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", - Valid: false, - }, - - { - // missing value for ServerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DBFORMYSQL/SERVERS/SERVER1/VIRTUALNETWORKRULES/VIRTUALNETWORKRULE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := VirtualNetworkRuleID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} From 99cf0aed2fc16d4e8f60945af9cc60e69217400a Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 16:43:28 -0700 Subject: [PATCH 07/12] swap azurerm_mysql_active_directory_administrator to hashicorp/go-azure-sdk --- internal/services/mysql/client/client.go | 7 -- .../mysql/mysql_aad_administrator_resource.go | 67 +++++++++---------- .../mysql_aad_administrator_resource_test.go | 16 ++--- 3 files changed, 40 insertions(+), 50 deletions(-) diff --git a/internal/services/mysql/client/client.go b/internal/services/mysql/client/client.go index 742d518822f7..e28342957d4b 100644 --- a/internal/services/mysql/client/client.go +++ b/internal/services/mysql/client/client.go @@ -6,7 +6,6 @@ package client import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck servers_v2017_12_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01" servers_v2020_01_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2020-01-01" flexibleServers_v2021_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01" @@ -20,8 +19,6 @@ type Client struct { MySqlClient *servers_v2017_12_01.Client ServerKeysClient *servers_v2020_01_01.Client - ServerAdministratorsClient *mysql.ServerAdministratorsClient - // TODO: port over to using the Meta Client (which involves bumping the API Version) AzureADAdministratorsClient *azureadadministrators.AzureADAdministratorsClient } @@ -54,9 +51,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(azureADAdministratorsClient.Client, o.Authorizers.ResourceManager) - serverAdministratorsClient := mysql.NewServerAdministratorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&serverAdministratorsClient.Client, o.ResourceManagerAuthorizer) - return &Client{ FlexibleServers: flexibleServersMetaClient, MySqlClient: mySqlMetaClient, @@ -64,6 +58,5 @@ func NewClient(o *common.ClientOptions) (*Client, error) { // TODO: switch to using the Meta Clients AzureADAdministratorsClient: azureADAdministratorsClient, - ServerAdministratorsClient: &serverAdministratorsClient, }, nil } diff --git a/internal/services/mysql/mysql_aad_administrator_resource.go b/internal/services/mysql/mysql_aad_administrator_resource.go index c86fddba0f7e..478f2b38afd2 100644 --- a/internal/services/mysql/mysql_aad_administrator_resource.go +++ b/internal/services/mysql/mysql_aad_administrator_resource.go @@ -8,16 +8,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" // nolint: staticcheck - "github.com/gofrs/uuid" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceMySQLAdministrator() *pluginsdk.Resource { @@ -68,7 +67,7 @@ func resourceMySQLAdministrator() *pluginsdk.Resource { } func resourceMySQLAdministratorCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServerAdministratorsClient + client := meta.(*clients.Client).MySQL.MySqlClient.ServerAdministrators subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -76,47 +75,41 @@ func resourceMySQLAdministratorCreateUpdate(d *pluginsdk.ResourceData, meta inte serverName := d.Get("server_name").(string) resGroup := d.Get("resource_group_name").(string) login := d.Get("login").(string) - objectId := uuid.FromStringOrNil(d.Get("object_id").(string)) - tenantId := uuid.FromStringOrNil(d.Get("tenant_id").(string)) - id := parse.NewAzureActiveDirectoryAdministratorID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), "activeDirectory") + id := parse.NewAzureActiveDirectoryAdministratorID(subscriptionId, resGroup, serverName, "activeDirectory") + serverId := serveradministrators.NewServerID(subscriptionId, resGroup, serverName) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, serverName) + existing, err := client.Get(ctx, serverId) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mysql_active_directory_administrator", id.ID()) } } - parameters := mysql.ServerAdministratorResource{ - ServerAdministratorProperties: &mysql.ServerAdministratorProperties{ - AdministratorType: utils.String("ActiveDirectory"), - Login: utils.String(login), - Sid: &objectId, - TenantID: &tenantId, + parameters := serveradministrators.ServerAdministratorResource{ + Properties: &serveradministrators.ServerAdministratorProperties{ + AdministratorType: serveradministrators.AdministratorTypeActiveDirectory, + Login: login, + Sid: d.Get("object_id").(string), + TenantId: d.Get("tenant_id").(string), }, } - future, err := client.CreateOrUpdate(ctx, resGroup, serverName, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, serverId, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return nil } func resourceMySQLAdministratorRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServerAdministratorsClient + client := meta.(*clients.Client).MySQL.MySqlClient.ServerAdministrators ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -125,9 +118,11 @@ func resourceMySQLAdministratorRead(d *pluginsdk.ResourceData, meta interface{}) return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName) + serverId := serveradministrators.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) + + resp, err := client.Get(ctx, serverId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil @@ -138,15 +133,20 @@ func resourceMySQLAdministratorRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("resource_group_name", id.ResourceGroup) d.Set("server_name", id.ServerName) - d.Set("login", resp.Login) - d.Set("object_id", resp.Sid.String()) - d.Set("tenant_id", resp.TenantID.String()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("login", props.Login) + d.Set("object_id", props.Sid) + d.Set("tenant_id", props.TenantId) + } + } return nil } func resourceMySQLAdministratorDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).MySQL.ServerAdministratorsClient + client := meta.(*clients.Client).MySQL.MySqlClient.ServerAdministrators ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() @@ -155,13 +155,10 @@ func resourceMySQLAdministratorDelete(d *pluginsdk.ResourceData, meta interface{ return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName) - if err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } + serverId := serveradministrators.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + if err = client.DeleteThenPoll(ctx, serverId); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/mysql/mysql_aad_administrator_resource_test.go b/internal/services/mysql/mysql_aad_administrator_resource_test.go index 43b9f52fbd5a..447d625d9628 100644 --- a/internal/services/mysql/mysql_aad_administrator_resource_test.go +++ b/internal/services/mysql/mysql_aad_administrator_resource_test.go @@ -8,6 +8,7 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/serveradministrators" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -78,12 +79,14 @@ func (r MySqlAdministratorResource) Exists(ctx context.Context, clients *clients return nil, err } - resp, err := clients.MySQL.ServerAdministratorsClient.Get(ctx, id.ResourceGroup, id.ServerName) + serverId := serveradministrators.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) + + resp, err := clients.MySQL.MySqlClient.ServerAdministrators.Get(ctx, serverId) if err != nil { return nil, fmt.Errorf("reading %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r MySqlAdministratorResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { @@ -92,13 +95,10 @@ func (r MySqlAdministratorResource) Destroy(ctx context.Context, client *clients return nil, err } - future, err := client.MySQL.ServerAdministratorsClient.Delete(ctx, id.ResourceGroup, id.ServerName) - if err != nil { - return nil, fmt.Errorf("deleting %s: %+v", *id, err) - } + serverId := serveradministrators.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) - if err := future.WaitForCompletionRef(ctx, client.MySQL.ServerAdministratorsClient.Client); err != nil { - return nil, fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + if err = client.MySQL.MySqlClient.ServerAdministrators.DeleteThenPoll(ctx, serverId); err != nil { + return nil, fmt.Errorf("deleting %s: %+v", *id, err) } return utils.Bool(true), nil From 6fd4c7f5c86364bf8382b0736f599332924cce5a Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 17:01:12 -0700 Subject: [PATCH 08/12] remove old sdk --- .../mysql/mgmt/2020-01-01/mysql/CHANGELOG.md | 2 - .../mysql/mgmt/2020-01-01/mysql/_meta.json | 11 - .../mysql/mgmt/2020-01-01/mysql/advisors.go | 248 - .../2020-01-01/mysql/checknameavailability.go | 118 - .../mysql/mgmt/2020-01-01/mysql/client.go | 225 - .../mgmt/2020-01-01/mysql/configurations.go | 299 - .../mysql/mgmt/2020-01-01/mysql/databases.go | 388 -- .../mysql/mgmt/2020-01-01/mysql/enums.go | 312 - .../mgmt/2020-01-01/mysql/firewallrules.go | 395 -- .../mysql/locationbasedperformancetier.go | 115 - ...ecommendedactionsessionsoperationstatus.go | 118 - ...ionbasedrecommendedactionsessionsresult.go | 160 - .../mysql/mgmt/2020-01-01/mysql/logfiles.go | 119 - .../mysql/mgmt/2020-01-01/mysql/models.go | 5469 ----------------- .../mysql/mgmt/2020-01-01/mysql/operations.go | 100 - .../mysql/privateendpointconnections.go | 527 -- .../2020-01-01/mysql/privatelinkresources.go | 249 - .../mysql/mgmt/2020-01-01/mysql/querytexts.go | 252 - .../2020-01-01/mysql/recommendedactions.go | 257 - .../2020-01-01/mysql/recoverableservers.go | 120 - .../mysql/mgmt/2020-01-01/mysql/replicas.go | 119 - .../2020-01-01/mysql/serveradministrators.go | 391 -- .../mysql/serverbasedperformancetier.go | 120 - .../mysql/mgmt/2020-01-01/mysql/serverkeys.go | 434 -- .../mgmt/2020-01-01/mysql/serverparameters.go | 126 - .../mysql/mgmt/2020-01-01/mysql/servers.go | 907 --- .../mysql/serversecurityalertpolicies.go | 340 - .../2020-01-01/mysql/topquerystatistics.go | 261 - .../mysql/mgmt/2020-01-01/mysql/version.go | 19 - .../2020-01-01/mysql/virtualnetworkrules.go | 434 -- .../mgmt/2020-01-01/mysql/waitstatistics.go | 257 - vendor/modules.txt | 1 - 32 files changed, 12893 deletions(-) delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/advisors.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/checknameavailability.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/configurations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/databases.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/enums.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/firewallrules.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedperformancetier.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsoperationstatus.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsresult.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/logfiles.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/operations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privateendpointconnections.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privatelinkresources.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/querytexts.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recommendedactions.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recoverableservers.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/replicas.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serveradministrators.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverbasedperformancetier.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverkeys.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverparameters.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/servers.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serversecurityalertpolicies.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/topquerystatistics.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/version.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/virtualnetworkrules.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/waitstatistics.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/_meta.json deleted file mode 100644 index 4178a127c810..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "e3980786418c280ecd7ed2e141407ed0f63cd493", - "readme": "/_/azure-rest-api-specs/specification/mysql/resource-manager/readme.md", - "tag": "package-2020-01-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-01-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/mysql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/advisors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/advisors.go deleted file mode 100644 index 2224ad21bf32..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/advisors.go +++ /dev/null @@ -1,248 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AdvisorsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type AdvisorsClient struct { - BaseClient -} - -// NewAdvisorsClient creates an instance of the AdvisorsClient client. -func NewAdvisorsClient(subscriptionID string) AdvisorsClient { - return NewAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAdvisorsClientWithBaseURI creates an instance of the AdvisorsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) AdvisorsClient { - return AdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a recommendation action advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -func (client AdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (result Advisor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.AdvisorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, advisorName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AdvisorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AdvisorsClient) GetResponder(resp *http.Response) (result Advisor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list recommendation action advisors. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client AdvisorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result AdvisorsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsClient.ListByServer") - defer func() { - sc := -1 - if result.arl.Response.Response != nil { - sc = result.arl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.AdvisorsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.arl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.arl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.arl.hasNextLink() && result.arl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client AdvisorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client AdvisorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client AdvisorsClient) ListByServerResponder(resp *http.Response) (result AdvisorsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client AdvisorsClient) listByServerNextResults(ctx context.Context, lastResults AdvisorsResultList) (result AdvisorsResultList, err error) { - req, err := lastResults.advisorsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.AdvisorsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client AdvisorsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result AdvisorsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/checknameavailability.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/checknameavailability.go deleted file mode 100644 index 9b702ea68833..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/checknameavailability.go +++ /dev/null @@ -1,118 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CheckNameAvailabilityClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type CheckNameAvailabilityClient struct { - BaseClient -} - -// NewCheckNameAvailabilityClient creates an instance of the CheckNameAvailabilityClient client. -func NewCheckNameAvailabilityClient(subscriptionID string) CheckNameAvailabilityClient { - return NewCheckNameAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCheckNameAvailabilityClientWithBaseURI creates an instance of the CheckNameAvailabilityClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewCheckNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckNameAvailabilityClient { - return CheckNameAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute check the availability of name for resource -// Parameters: -// nameAvailabilityRequest - the required parameters for checking if resource name is available. -func (client CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (result NameAvailability, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CheckNameAvailabilityClient.Execute") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: nameAvailabilityRequest, - Constraints: []validation.Constraint{{Target: "nameAvailabilityRequest.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.CheckNameAvailabilityClient", "Execute", err.Error()) - } - - req, err := client.ExecutePreparer(ctx, nameAvailabilityRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.CheckNameAvailabilityClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.CheckNameAvailabilityClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.CheckNameAvailabilityClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability", pathParameters), - autorest.WithJSON(nameAvailabilityRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client CheckNameAvailabilityClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client CheckNameAvailabilityClient) ExecuteResponder(resp *http.Response) (result NameAvailability, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/client.go deleted file mode 100644 index c84b5af60a4a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/client.go +++ /dev/null @@ -1,225 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package mysql implements the Azure ARM Mysql service API version . -// -// The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources -// including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Mysql - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Mysql. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CreateRecommendedActionSession create recommendation action session for the advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -// databaseName - the name of the database. -func (client BaseClient) CreateRecommendedActionSession(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string) (result CreateRecommendedActionSessionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateRecommendedActionSession") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.BaseClient", "CreateRecommendedActionSession", err.Error()) - } - - req, err := client.CreateRecommendedActionSessionPreparer(ctx, resourceGroupName, serverName, advisorName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.BaseClient", "CreateRecommendedActionSession", nil, "Failure preparing request") - return - } - - result, err = client.CreateRecommendedActionSessionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.BaseClient", "CreateRecommendedActionSession", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateRecommendedActionSessionPreparer prepares the CreateRecommendedActionSession request. -func (client BaseClient) CreateRecommendedActionSessionPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "databaseName": autorest.Encode("query", databaseName), - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateRecommendedActionSessionSender sends the CreateRecommendedActionSession request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) CreateRecommendedActionSessionSender(req *http.Request) (future CreateRecommendedActionSessionFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateRecommendedActionSessionResponder handles the response to the CreateRecommendedActionSession request. The method always -// closes the http.Response Body. -func (client BaseClient) CreateRecommendedActionSessionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResetQueryPerformanceInsightData reset data for Query Performance Insight. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client BaseClient) ResetQueryPerformanceInsightData(ctx context.Context, resourceGroupName string, serverName string) (result QueryPerformanceInsightResetDataResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ResetQueryPerformanceInsightData") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.BaseClient", "ResetQueryPerformanceInsightData", err.Error()) - } - - req, err := client.ResetQueryPerformanceInsightDataPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.BaseClient", "ResetQueryPerformanceInsightData", nil, "Failure preparing request") - return - } - - resp, err := client.ResetQueryPerformanceInsightDataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.BaseClient", "ResetQueryPerformanceInsightData", resp, "Failure sending request") - return - } - - result, err = client.ResetQueryPerformanceInsightDataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.BaseClient", "ResetQueryPerformanceInsightData", resp, "Failure responding to request") - return - } - - return -} - -// ResetQueryPerformanceInsightDataPreparer prepares the ResetQueryPerformanceInsightData request. -func (client BaseClient) ResetQueryPerformanceInsightDataPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/resetQueryPerformanceInsightData", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResetQueryPerformanceInsightDataSender sends the ResetQueryPerformanceInsightData request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ResetQueryPerformanceInsightDataSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResetQueryPerformanceInsightDataResponder handles the response to the ResetQueryPerformanceInsightData request. The method always -// closes the http.Response Body. -func (client BaseClient) ResetQueryPerformanceInsightDataResponder(resp *http.Response) (result QueryPerformanceInsightResetDataResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/configurations.go deleted file mode 100644 index 9386a3a55484..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/configurations.go +++ /dev/null @@ -1,299 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type ConfigurationsClient struct { - BaseClient -} - -// NewConfigurationsClient creates an instance of the ConfigurationsClient client. -func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { - return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsClientWithBaseURI creates an instance of the ConfigurationsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { - return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a configuration of a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -// parameters - the required parameters for updating a server configuration. -func (client ConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ConfigurationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about a configuration of server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the configurations in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ConfigurationsClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) ListByServerResponder(resp *http.Response) (result ConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/databases.go deleted file mode 100644 index 4a80bbab9bb3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/databases.go +++ /dev/null @@ -1,388 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the required parameters for creating or updating a database. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.DatabasesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.DatabasesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.DatabasesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the databases in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.DatabasesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/enums.go deleted file mode 100644 index 47e745965f26..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/enums.go +++ /dev/null @@ -1,312 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModeGeoRestore ... - CreateModeGeoRestore CreateMode = "GeoRestore" - // CreateModePointInTimeRestore ... - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - // CreateModeReplica ... - CreateModeReplica CreateMode = "Replica" - // CreateModeServerPropertiesForCreate ... - CreateModeServerPropertiesForCreate CreateMode = "ServerPropertiesForCreate" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeDefault, CreateModeGeoRestore, CreateModePointInTimeRestore, CreateModeReplica, CreateModeServerPropertiesForCreate} -} - -// GeoRedundantBackup enumerates the values for geo redundant backup. -type GeoRedundantBackup string - -const ( - // Disabled ... - Disabled GeoRedundantBackup = "Disabled" - // Enabled ... - Enabled GeoRedundantBackup = "Enabled" -) - -// PossibleGeoRedundantBackupValues returns an array of possible values for the GeoRedundantBackup const type. -func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { - return []GeoRedundantBackup{Disabled, Enabled} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // SystemAssigned ... - SystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} -} - -// InfrastructureEncryption enumerates the values for infrastructure encryption. -type InfrastructureEncryption string - -const ( - // InfrastructureEncryptionDisabled Additional (2nd) layer of encryption for data at rest - InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" - // InfrastructureEncryptionEnabled Default value for single layer of encryption for data at rest. - InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" -) - -// PossibleInfrastructureEncryptionValues returns an array of possible values for the InfrastructureEncryption const type. -func PossibleInfrastructureEncryptionValues() []InfrastructureEncryption { - return []InfrastructureEncryption{InfrastructureEncryptionDisabled, InfrastructureEncryptionEnabled} -} - -// MinimalTLSVersionEnum enumerates the values for minimal tls version enum. -type MinimalTLSVersionEnum string - -const ( - // TLS10 ... - TLS10 MinimalTLSVersionEnum = "TLS1_0" - // TLS11 ... - TLS11 MinimalTLSVersionEnum = "TLS1_1" - // TLS12 ... - TLS12 MinimalTLSVersionEnum = "TLS1_2" - // TLSEnforcementDisabled ... - TLSEnforcementDisabled MinimalTLSVersionEnum = "TLSEnforcementDisabled" -) - -// PossibleMinimalTLSVersionEnumValues returns an array of possible values for the MinimalTLSVersionEnum const type. -func PossibleMinimalTLSVersionEnumValues() []MinimalTLSVersionEnum { - return []MinimalTLSVersionEnum{TLS10, TLS11, TLS12, TLSEnforcementDisabled} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // NotSpecified ... - NotSpecified OperationOrigin = "NotSpecified" - // System ... - System OperationOrigin = "system" - // User ... - User OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{NotSpecified, System, User} -} - -// PrivateEndpointProvisioningState enumerates the values for private endpoint provisioning state. -type PrivateEndpointProvisioningState string - -const ( - // Approving ... - Approving PrivateEndpointProvisioningState = "Approving" - // Dropping ... - Dropping PrivateEndpointProvisioningState = "Dropping" - // Failed ... - Failed PrivateEndpointProvisioningState = "Failed" - // Ready ... - Ready PrivateEndpointProvisioningState = "Ready" - // Rejecting ... - Rejecting PrivateEndpointProvisioningState = "Rejecting" -) - -// PossiblePrivateEndpointProvisioningStateValues returns an array of possible values for the PrivateEndpointProvisioningState const type. -func PossiblePrivateEndpointProvisioningStateValues() []PrivateEndpointProvisioningState { - return []PrivateEndpointProvisioningState{Approving, Dropping, Failed, Ready, Rejecting} -} - -// PrivateLinkServiceConnectionStateActionsRequire enumerates the values for private link service connection -// state actions require. -type PrivateLinkServiceConnectionStateActionsRequire string - -const ( - // None ... - None PrivateLinkServiceConnectionStateActionsRequire = "None" -) - -// PossiblePrivateLinkServiceConnectionStateActionsRequireValues returns an array of possible values for the PrivateLinkServiceConnectionStateActionsRequire const type. -func PossiblePrivateLinkServiceConnectionStateActionsRequireValues() []PrivateLinkServiceConnectionStateActionsRequire { - return []PrivateLinkServiceConnectionStateActionsRequire{None} -} - -// PrivateLinkServiceConnectionStateStatus enumerates the values for private link service connection state -// status. -type PrivateLinkServiceConnectionStateStatus string - -const ( - // Approved ... - Approved PrivateLinkServiceConnectionStateStatus = "Approved" - // Disconnected ... - Disconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" - // Pending ... - Pending PrivateLinkServiceConnectionStateStatus = "Pending" - // Rejected ... - Rejected PrivateLinkServiceConnectionStateStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStateStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStateStatus const type. -func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { - return []PrivateLinkServiceConnectionStateStatus{Approved, Disconnected, Pending, Rejected} -} - -// PublicNetworkAccessEnum enumerates the values for public network access enum. -type PublicNetworkAccessEnum string - -const ( - // PublicNetworkAccessEnumDisabled ... - PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" - // PublicNetworkAccessEnumEnabled ... - PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" -) - -// PossiblePublicNetworkAccessEnumValues returns an array of possible values for the PublicNetworkAccessEnum const type. -func PossiblePublicNetworkAccessEnumValues() []PublicNetworkAccessEnum { - return []PublicNetworkAccessEnum{PublicNetworkAccessEnumDisabled, PublicNetworkAccessEnumEnabled} -} - -// QueryPerformanceInsightResetDataResultState enumerates the values for query performance insight reset data -// result state. -type QueryPerformanceInsightResetDataResultState string - -const ( - // QueryPerformanceInsightResetDataResultStateFailed ... - QueryPerformanceInsightResetDataResultStateFailed QueryPerformanceInsightResetDataResultState = "Failed" - // QueryPerformanceInsightResetDataResultStateSucceeded ... - QueryPerformanceInsightResetDataResultStateSucceeded QueryPerformanceInsightResetDataResultState = "Succeeded" -) - -// PossibleQueryPerformanceInsightResetDataResultStateValues returns an array of possible values for the QueryPerformanceInsightResetDataResultState const type. -func PossibleQueryPerformanceInsightResetDataResultStateValues() []QueryPerformanceInsightResetDataResultState { - return []QueryPerformanceInsightResetDataResultState{QueryPerformanceInsightResetDataResultStateFailed, QueryPerformanceInsightResetDataResultStateSucceeded} -} - -// ServerSecurityAlertPolicyState enumerates the values for server security alert policy state. -type ServerSecurityAlertPolicyState string - -const ( - // ServerSecurityAlertPolicyStateDisabled ... - ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" - // ServerSecurityAlertPolicyStateEnabled ... - ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" -) - -// PossibleServerSecurityAlertPolicyStateValues returns an array of possible values for the ServerSecurityAlertPolicyState const type. -func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyState { - return []ServerSecurityAlertPolicyState{ServerSecurityAlertPolicyStateDisabled, ServerSecurityAlertPolicyStateEnabled} -} - -// ServerState enumerates the values for server state. -type ServerState string - -const ( - // ServerStateDisabled ... - ServerStateDisabled ServerState = "Disabled" - // ServerStateDropping ... - ServerStateDropping ServerState = "Dropping" - // ServerStateInaccessible ... - ServerStateInaccessible ServerState = "Inaccessible" - // ServerStateReady ... - ServerStateReady ServerState = "Ready" -) - -// PossibleServerStateValues returns an array of possible values for the ServerState const type. -func PossibleServerStateValues() []ServerState { - return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateInaccessible, ServerStateReady} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // EightFullStopZero ... - EightFullStopZero ServerVersion = "8.0" - // FiveFullStopSeven ... - FiveFullStopSeven ServerVersion = "5.7" - // FiveFullStopSix ... - FiveFullStopSix ServerVersion = "5.6" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{EightFullStopZero, FiveFullStopSeven, FiveFullStopSix} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Basic ... - Basic SkuTier = "Basic" - // GeneralPurpose ... - GeneralPurpose SkuTier = "GeneralPurpose" - // MemoryOptimized ... - MemoryOptimized SkuTier = "MemoryOptimized" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Basic, GeneralPurpose, MemoryOptimized} -} - -// SslEnforcementEnum enumerates the values for ssl enforcement enum. -type SslEnforcementEnum string - -const ( - // SslEnforcementEnumDisabled ... - SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" - // SslEnforcementEnumEnabled ... - SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" -) - -// PossibleSslEnforcementEnumValues returns an array of possible values for the SslEnforcementEnum const type. -func PossibleSslEnforcementEnumValues() []SslEnforcementEnum { - return []SslEnforcementEnum{SslEnforcementEnumDisabled, SslEnforcementEnumEnabled} -} - -// StorageAutogrow enumerates the values for storage autogrow. -type StorageAutogrow string - -const ( - // StorageAutogrowDisabled ... - StorageAutogrowDisabled StorageAutogrow = "Disabled" - // StorageAutogrowEnabled ... - StorageAutogrowEnabled StorageAutogrow = "Enabled" -) - -// PossibleStorageAutogrowValues returns an array of possible values for the StorageAutogrow const type. -func PossibleStorageAutogrowValues() []StorageAutogrow { - return []StorageAutogrow{StorageAutogrowDisabled, StorageAutogrowEnabled} -} - -// VirtualNetworkRuleState enumerates the values for virtual network rule state. -type VirtualNetworkRuleState string - -const ( - // VirtualNetworkRuleStateDeleting ... - VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" - // VirtualNetworkRuleStateInitializing ... - VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" - // VirtualNetworkRuleStateInProgress ... - VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" - // VirtualNetworkRuleStateReady ... - VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" - // VirtualNetworkRuleStateUnknown ... - VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" -) - -// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. -func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { - return []VirtualNetworkRuleState{VirtualNetworkRuleStateDeleting, VirtualNetworkRuleStateInitializing, VirtualNetworkRuleStateInProgress, VirtualNetworkRuleStateReady, VirtualNetworkRuleStateUnknown} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/firewallrules.go deleted file mode 100644 index 87922d958ae5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/firewallrules.go +++ /dev/null @@ -1,395 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FirewallRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new firewall rule or updates an existing firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -// parameters - the required parameters for creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("mysql.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (future FirewallRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.FirewallRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (future FirewallRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.FirewallRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the firewall rules in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.FirewallRulesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedperformancetier.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedperformancetier.go deleted file mode 100644 index 825f9c6f7867..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedperformancetier.go +++ /dev/null @@ -1,115 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files -// and configurations with new business model. -type LocationBasedPerformanceTierClient struct { - BaseClient -} - -// NewLocationBasedPerformanceTierClient creates an instance of the LocationBasedPerformanceTierClient client. -func NewLocationBasedPerformanceTierClient(subscriptionID string) LocationBasedPerformanceTierClient { - return NewLocationBasedPerformanceTierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedPerformanceTierClientWithBaseURI creates an instance of the LocationBasedPerformanceTierClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewLocationBasedPerformanceTierClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedPerformanceTierClient { - return LocationBasedPerformanceTierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers at specified location in a given subscription. -// Parameters: -// locationName - the name of the location. -func (client LocationBasedPerformanceTierClient) List(ctx context.Context, locationName string) (result PerformanceTierListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedPerformanceTierClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.LocationBasedPerformanceTierClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedPerformanceTierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.LocationBasedPerformanceTierClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedPerformanceTierClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LocationBasedPerformanceTierClient) ListPreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedPerformanceTierClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LocationBasedPerformanceTierClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsoperationstatus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsoperationstatus.go deleted file mode 100644 index d26c91f8a8db..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsoperationstatus.go +++ /dev/null @@ -1,118 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedRecommendedActionSessionsOperationStatusClient is the the Microsoft Azure management API provides -// create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall -// rules, VNET rules, log files and configurations with new business model. -type LocationBasedRecommendedActionSessionsOperationStatusClient struct { - BaseClient -} - -// NewLocationBasedRecommendedActionSessionsOperationStatusClient creates an instance of the -// LocationBasedRecommendedActionSessionsOperationStatusClient client. -func NewLocationBasedRecommendedActionSessionsOperationStatusClient(subscriptionID string) LocationBasedRecommendedActionSessionsOperationStatusClient { - return NewLocationBasedRecommendedActionSessionsOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedRecommendedActionSessionsOperationStatusClientWithBaseURI creates an instance of the -// LocationBasedRecommendedActionSessionsOperationStatusClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationBasedRecommendedActionSessionsOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedRecommendedActionSessionsOperationStatusClient { - return LocationBasedRecommendedActionSessionsOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get recommendation action session operation status. -// Parameters: -// locationName - the name of the location. -// operationID - the operation identifier. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) Get(ctx context.Context, locationName string, operationID string) (result RecommendedActionSessionsOperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedRecommendedActionSessionsOperationStatusClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, locationName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) GetPreparer(ctx context.Context, locationName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/recommendedActionSessionsAzureAsyncOperation/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) GetResponder(resp *http.Response) (result RecommendedActionSessionsOperationStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsresult.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsresult.go deleted file mode 100644 index f0fdf432726f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/locationbasedrecommendedactionsessionsresult.go +++ /dev/null @@ -1,160 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedRecommendedActionSessionsResultClient is the the Microsoft Azure management API provides create, read, -// update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, -// log files and configurations with new business model. -type LocationBasedRecommendedActionSessionsResultClient struct { - BaseClient -} - -// NewLocationBasedRecommendedActionSessionsResultClient creates an instance of the -// LocationBasedRecommendedActionSessionsResultClient client. -func NewLocationBasedRecommendedActionSessionsResultClient(subscriptionID string) LocationBasedRecommendedActionSessionsResultClient { - return NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI creates an instance of the -// LocationBasedRecommendedActionSessionsResultClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedRecommendedActionSessionsResultClient { - return LocationBasedRecommendedActionSessionsResultClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List recommendation action session operation result. -// Parameters: -// locationName - the name of the location. -// operationID - the operation identifier. -func (client LocationBasedRecommendedActionSessionsResultClient) List(ctx context.Context, locationName string, operationID string) (result RecommendationActionsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedRecommendedActionSessionsResultClient.List") - defer func() { - sc := -1 - if result.rarl.Response.Response != nil { - sc = result.rarl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.LocationBasedRecommendedActionSessionsResultClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, locationName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsResultClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rarl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsResultClient", "List", resp, "Failure sending request") - return - } - - result.rarl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsResultClient", "List", resp, "Failure responding to request") - return - } - if result.rarl.hasNextLink() && result.rarl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LocationBasedRecommendedActionSessionsResultClient) ListPreparer(ctx context.Context, locationName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/recommendedActionSessionsOperationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedRecommendedActionSessionsResultClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LocationBasedRecommendedActionSessionsResultClient) ListResponder(resp *http.Response) (result RecommendationActionsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client LocationBasedRecommendedActionSessionsResultClient) listNextResults(ctx context.Context, lastResults RecommendationActionsResultList) (result RecommendationActionsResultList, err error) { - req, err := lastResults.recommendationActionsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsResultClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsResultClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LocationBasedRecommendedActionSessionsResultClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationBasedRecommendedActionSessionsResultClient) ListComplete(ctx context.Context, locationName string, operationID string) (result RecommendationActionsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedRecommendedActionSessionsResultClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, locationName, operationID) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/logfiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/logfiles.go deleted file mode 100644 index 7a0f58a1674d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/logfiles.go +++ /dev/null @@ -1,119 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type LogFilesClient struct { - BaseClient -} - -// NewLogFilesClient creates an instance of the LogFilesClient client. -func NewLogFilesClient(subscriptionID string) LogFilesClient { - return NewLogFilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogFilesClientWithBaseURI creates an instance of the LogFilesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFilesClient { - return LogFilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer list all the log files in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client LogFilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result LogFileListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogFilesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.LogFilesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LogFilesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.LogFilesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.LogFilesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client LogFilesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/logFiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client LogFilesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client LogFilesClient) ListByServerResponder(resp *http.Response) (result LogFileListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/models.go deleted file mode 100644 index a19d124d3e26..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/models.go +++ /dev/null @@ -1,5469 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" - -// Advisor represents a recommendation action advisor. -type Advisor struct { - autorest.Response `json:"-"` - // Properties - The properties of a recommendation action advisor. - Properties interface{} `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Advisor. -func (a Advisor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Properties != nil { - objectMap["properties"] = a.Properties - } - return json.Marshal(objectMap) -} - -// AdvisorsResultList a list of query statistics. -type AdvisorsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of recommendation action advisors. - Value *[]Advisor `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdvisorsResultList. -func (arl AdvisorsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AdvisorsResultListIterator provides access to a complete listing of Advisor values. -type AdvisorsResultListIterator struct { - i int - page AdvisorsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AdvisorsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AdvisorsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AdvisorsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AdvisorsResultListIterator) Response() AdvisorsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AdvisorsResultListIterator) Value() Advisor { - if !iter.page.NotDone() { - return Advisor{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AdvisorsResultListIterator type. -func NewAdvisorsResultListIterator(page AdvisorsResultListPage) AdvisorsResultListIterator { - return AdvisorsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arl AdvisorsResultList) IsEmpty() bool { - return arl.Value == nil || len(*arl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arl AdvisorsResultList) hasNextLink() bool { - return arl.NextLink != nil && len(*arl.NextLink) != 0 -} - -// advisorsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arl AdvisorsResultList) advisorsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !arl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arl.NextLink))) -} - -// AdvisorsResultListPage contains a page of Advisor values. -type AdvisorsResultListPage struct { - fn func(context.Context, AdvisorsResultList) (AdvisorsResultList, error) - arl AdvisorsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AdvisorsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arl) - if err != nil { - return err - } - page.arl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AdvisorsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AdvisorsResultListPage) NotDone() bool { - return !page.arl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AdvisorsResultListPage) Response() AdvisorsResultList { - return page.arl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AdvisorsResultListPage) Values() []Advisor { - if page.arl.IsEmpty() { - return nil - } - return *page.arl.Value -} - -// Creates a new instance of the AdvisorsResultListPage type. -func NewAdvisorsResultListPage(cur AdvisorsResultList, getNextPage func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)) AdvisorsResultListPage { - return AdvisorsResultListPage{ - fn: getNextPage, - arl: cur, - } -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError an error response from the Batch service. -type CloudError struct { - // Error - Error message - Error *ErrorResponse `json:"error,omitempty"` -} - -// Configuration represents a Configuration. -type Configuration struct { - autorest.Response `json:"-"` - // ConfigurationProperties - The properties of a configuration. - *ConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConfigurationProperties != nil { - objectMap["properties"] = c.ConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Configuration struct. -func (c *Configuration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var configurationProperties ConfigurationProperties - err = json.Unmarshal(*v, &configurationProperties) - if err != nil { - return err - } - c.ConfigurationProperties = &configurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ConfigurationListResult a list of server configurations. -type ConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - The list of server configurations. - Value *[]Configuration `json:"value,omitempty"` -} - -// ConfigurationProperties the properties of a configuration. -type ConfigurationProperties struct { - // Value - Value of the configuration. - Value *string `json:"value,omitempty"` - // Description - READ-ONLY; Description of the configuration. - Description *string `json:"description,omitempty"` - // DefaultValue - READ-ONLY; Default value of the configuration. - DefaultValue *string `json:"defaultValue,omitempty"` - // DataType - READ-ONLY; Data type of the configuration. - DataType *string `json:"dataType,omitempty"` - // AllowedValues - READ-ONLY; Allowed values of the configuration. - AllowedValues *string `json:"allowedValues,omitempty"` - // Source - Source of the configuration. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationProperties. -func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Value != nil { - objectMap["value"] = cp.Value - } - if cp.Source != nil { - objectMap["source"] = cp.Source - } - return json.Marshal(objectMap) -} - -// ConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationsClient) (Configuration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationsCreateOrUpdateFuture.Result. -func (future *ConfigurationsCreateOrUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// CreateRecommendedActionSessionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CreateRecommendedActionSessionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateRecommendedActionSessionFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateRecommendedActionSessionFuture.Result. -func (future *CreateRecommendedActionSessionFuture) result(client BaseClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.CreateRecommendedActionSessionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.CreateRecommendedActionSessionFuture") - return - } - ar.Response = future.Response() - return -} - -// Database represents a Database. -type Database struct { - autorest.Response `json:"-"` - // DatabaseProperties - The properties of a database. - *DatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseListResult a List of databases. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of databases housed in a server - Value *[]Database `json:"value,omitempty"` -} - -// DatabaseProperties the properties of a database. -type DatabaseProperties struct { - // Charset - The charset of the database. - Charset *string `json:"charset,omitempty"` - // Collation - The collation of the database. - Collation *string `json:"collation,omitempty"` -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.) -type ErrorResponse struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FirewallRule represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // FirewallRuleProperties - The properties of a firewall rule. - *FirewallRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult a list of firewall rules. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of firewall rules in a server. - Value *[]FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format. - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FirewallRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (FirewallRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result. -func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.FirewallRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { - fr, err = client.CreateOrUpdateResponder(fr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") - } - } - return -} - -// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FirewallRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesDeleteFuture.Result. -func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.FirewallRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LogFile represents a log file. -type LogFile struct { - // LogFileProperties - The properties of the log file. - *LogFileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogFile. -func (lf LogFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lf.LogFileProperties != nil { - objectMap["properties"] = lf.LogFileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogFile struct. -func (lf *LogFile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var logFileProperties LogFileProperties - err = json.Unmarshal(*v, &logFileProperties) - if err != nil { - return err - } - lf.LogFileProperties = &logFileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lf.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lf.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lf.Type = &typeVar - } - } - } - - return nil -} - -// LogFileListResult a list of log files. -type LogFileListResult struct { - autorest.Response `json:"-"` - // Value - The list of log files. - Value *[]LogFile `json:"value,omitempty"` -} - -// LogFileProperties the properties of a log file. -type LogFileProperties struct { - // SizeInKB - Size of the log file. - SizeInKB *int64 `json:"sizeInKB,omitempty"` - // CreatedTime - READ-ONLY; Creation timestamp of the log file. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified timestamp of the log file. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Type - Type of the log file. - Type *string `json:"type,omitempty"` - // URL - The url to download the log file from. - URL *string `json:"url,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogFileProperties. -func (lfp LogFileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lfp.SizeInKB != nil { - objectMap["sizeInKB"] = lfp.SizeInKB - } - if lfp.Type != nil { - objectMap["type"] = lfp.Type - } - if lfp.URL != nil { - objectMap["url"] = lfp.URL - } - return json.Marshal(objectMap) -} - -// NameAvailability represents a resource name availability. -type NameAvailability struct { - autorest.Response `json:"-"` - // Message - Error Message. - Message *string `json:"message,omitempty"` - // NameAvailable - Indicates whether the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - Reason for name being unavailable. - Reason *string `json:"reason,omitempty"` -} - -// NameAvailabilityRequest request from client to check resource name availability. -type NameAvailabilityRequest struct { - // Name - Resource name to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. - Type *string `json:"type,omitempty"` -} - -// Operation REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation or action. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Operation resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; Operation description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of resource provider operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of resource provider operations. - Value *[]Operation `json:"value,omitempty"` -} - -// PerformanceTierListResult a list of performance tiers. -type PerformanceTierListResult struct { - autorest.Response `json:"-"` - // Value - The list of performance tiers - Value *[]PerformanceTierProperties `json:"value,omitempty"` -} - -// PerformanceTierProperties performance tier properties -type PerformanceTierProperties struct { - // ID - ID of the performance tier. - ID *string `json:"id,omitempty"` - // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition - MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` - // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition - MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` - // MaxStorageMB - Max storage allowed for a server. - MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` - // MinLargeStorageMB - Max storage allowed for a server. - MinLargeStorageMB *int32 `json:"minLargeStorageMB,omitempty"` - // MaxLargeStorageMB - Max storage allowed for a server. - MaxLargeStorageMB *int32 `json:"maxLargeStorageMB,omitempty"` - // MinStorageMB - Max storage allowed for a server. - MinStorageMB *int32 `json:"minStorageMB,omitempty"` - // ServiceLevelObjectives - Service level objectives associated with the performance tier - ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` -} - -// PerformanceTierServiceLevelObjectives service level objectives for performance tier. -type PerformanceTierServiceLevelObjectives struct { - // ID - ID for the service level objective. - ID *string `json:"id,omitempty"` - // Edition - Edition of the performance tier. - Edition *string `json:"edition,omitempty"` - // VCore - vCore associated with the service level objective - VCore *int32 `json:"vCore,omitempty"` - // HardwareGeneration - Hardware generation associated with the service level objective - HardwareGeneration *string `json:"hardwareGeneration,omitempty"` - // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition - MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` - // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition - MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` - // MaxStorageMB - Max storage allowed for a server. - MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` - // MinStorageMB - Max storage allowed for a server. - MinStorageMB *int32 `json:"minStorageMB,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclr) - if err != nil { - return err - } - page.peclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsUpdateTagsFuture.Result. -func (future *PrivateEndpointConnectionsUpdateTagsFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.PrivateEndpointConnectionsUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.UpdateTagsResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsUpdateTagsFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointProperty ... -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource group id. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrlr) - if err != nil { - return err - } - page.plrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty ... -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryPerformanceInsightResetDataResult result of Query Performance Insight data reset. -type QueryPerformanceInsightResetDataResult struct { - autorest.Response `json:"-"` - // Status - Indicates result of the operation. Possible values include: 'QueryPerformanceInsightResetDataResultStateSucceeded', 'QueryPerformanceInsightResetDataResultStateFailed' - Status QueryPerformanceInsightResetDataResultState `json:"status,omitempty"` - // Message - operation message. - Message *string `json:"message,omitempty"` -} - -// QueryStatistic represents a Query Statistic. -type QueryStatistic struct { - autorest.Response `json:"-"` - // QueryStatisticProperties - The properties of a query statistic. - *QueryStatisticProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryStatistic. -func (qs QueryStatistic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qs.QueryStatisticProperties != nil { - objectMap["properties"] = qs.QueryStatisticProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QueryStatistic struct. -func (qs *QueryStatistic) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queryStatisticProperties QueryStatisticProperties - err = json.Unmarshal(*v, &queryStatisticProperties) - if err != nil { - return err - } - qs.QueryStatisticProperties = &queryStatisticProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - qs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - qs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - qs.Type = &typeVar - } - } - } - - return nil -} - -// QueryStatisticProperties the properties of a query statistic. -type QueryStatisticProperties struct { - // QueryID - Database query identifier. - QueryID *string `json:"queryId,omitempty"` - // StartTime - Observation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Observation end time. - EndTime *date.Time `json:"endTime,omitempty"` - // AggregationFunction - Aggregation function name. - AggregationFunction *string `json:"aggregationFunction,omitempty"` - // DatabaseNames - The list of database names. - DatabaseNames *[]string `json:"databaseNames,omitempty"` - // QueryExecutionCount - Number of query executions in this time interval. - QueryExecutionCount *int64 `json:"queryExecutionCount,omitempty"` - // MetricName - Metric name. - MetricName *string `json:"metricName,omitempty"` - // MetricDisplayName - Metric display name. - MetricDisplayName *string `json:"metricDisplayName,omitempty"` - // MetricValue - Metric value. - MetricValue *float64 `json:"metricValue,omitempty"` - // MetricValueUnit - Metric value unit. - MetricValueUnit *string `json:"metricValueUnit,omitempty"` -} - -// QueryText represents a Query Text. -type QueryText struct { - autorest.Response `json:"-"` - // QueryTextProperties - The properties of a query text. - *QueryTextProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryText. -func (qt QueryText) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qt.QueryTextProperties != nil { - objectMap["properties"] = qt.QueryTextProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QueryText struct. -func (qt *QueryText) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queryTextProperties QueryTextProperties - err = json.Unmarshal(*v, &queryTextProperties) - if err != nil { - return err - } - qt.QueryTextProperties = &queryTextProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - qt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - qt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - qt.Type = &typeVar - } - } - } - - return nil -} - -// QueryTextProperties the properties of a query text. -type QueryTextProperties struct { - // QueryID - Query identifier unique to the server. - QueryID *string `json:"queryId,omitempty"` - // QueryText - Query text. - QueryText *string `json:"queryText,omitempty"` -} - -// QueryTextsResultList a list of query texts. -type QueryTextsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of query texts. - Value *[]QueryText `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryTextsResultList. -func (qtrl QueryTextsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryTextsResultListIterator provides access to a complete listing of QueryText values. -type QueryTextsResultListIterator struct { - i int - page QueryTextsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *QueryTextsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *QueryTextsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter QueryTextsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter QueryTextsResultListIterator) Response() QueryTextsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter QueryTextsResultListIterator) Value() QueryText { - if !iter.page.NotDone() { - return QueryText{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the QueryTextsResultListIterator type. -func NewQueryTextsResultListIterator(page QueryTextsResultListPage) QueryTextsResultListIterator { - return QueryTextsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (qtrl QueryTextsResultList) IsEmpty() bool { - return qtrl.Value == nil || len(*qtrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (qtrl QueryTextsResultList) hasNextLink() bool { - return qtrl.NextLink != nil && len(*qtrl.NextLink) != 0 -} - -// queryTextsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (qtrl QueryTextsResultList) queryTextsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !qtrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(qtrl.NextLink))) -} - -// QueryTextsResultListPage contains a page of QueryText values. -type QueryTextsResultListPage struct { - fn func(context.Context, QueryTextsResultList) (QueryTextsResultList, error) - qtrl QueryTextsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *QueryTextsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.qtrl) - if err != nil { - return err - } - page.qtrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *QueryTextsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page QueryTextsResultListPage) NotDone() bool { - return !page.qtrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page QueryTextsResultListPage) Response() QueryTextsResultList { - return page.qtrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page QueryTextsResultListPage) Values() []QueryText { - if page.qtrl.IsEmpty() { - return nil - } - return *page.qtrl.Value -} - -// Creates a new instance of the QueryTextsResultListPage type. -func NewQueryTextsResultListPage(cur QueryTextsResultList, getNextPage func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)) QueryTextsResultListPage { - return QueryTextsResultListPage{ - fn: getNextPage, - qtrl: cur, - } -} - -// RecommendationAction represents a Recommendation Action. -type RecommendationAction struct { - autorest.Response `json:"-"` - // RecommendationActionProperties - The properties of a recommendation action. - *RecommendationActionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendationAction. -func (ra RecommendationAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ra.RecommendationActionProperties != nil { - objectMap["properties"] = ra.RecommendationActionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendationAction struct. -func (ra *RecommendationAction) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recommendationActionProperties RecommendationActionProperties - err = json.Unmarshal(*v, &recommendationActionProperties) - if err != nil { - return err - } - ra.RecommendationActionProperties = &recommendationActionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ra.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ra.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ra.Type = &typeVar - } - } - } - - return nil -} - -// RecommendationActionProperties the properties of a recommendation action. -type RecommendationActionProperties struct { - // AdvisorName - Advisor name. - AdvisorName *string `json:"advisorName,omitempty"` - // SessionID - Recommendation action session identifier. - SessionID *string `json:"sessionId,omitempty"` - // ActionID - Recommendation action identifier. - ActionID *int32 `json:"actionId,omitempty"` - // CreatedTime - Recommendation action creation time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ExpirationTime - Recommendation action expiration time. - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // Reason - Recommendation action reason. - Reason *string `json:"reason,omitempty"` - // RecommendationType - Recommendation action type. - RecommendationType *string `json:"recommendationType,omitempty"` - // Details - Recommendation action details. - Details map[string]*string `json:"details"` -} - -// MarshalJSON is the custom marshaler for RecommendationActionProperties. -func (rap RecommendationActionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rap.AdvisorName != nil { - objectMap["advisorName"] = rap.AdvisorName - } - if rap.SessionID != nil { - objectMap["sessionId"] = rap.SessionID - } - if rap.ActionID != nil { - objectMap["actionId"] = rap.ActionID - } - if rap.CreatedTime != nil { - objectMap["createdTime"] = rap.CreatedTime - } - if rap.ExpirationTime != nil { - objectMap["expirationTime"] = rap.ExpirationTime - } - if rap.Reason != nil { - objectMap["reason"] = rap.Reason - } - if rap.RecommendationType != nil { - objectMap["recommendationType"] = rap.RecommendationType - } - if rap.Details != nil { - objectMap["details"] = rap.Details - } - return json.Marshal(objectMap) -} - -// RecommendationActionsResultList a list of recommendation actions. -type RecommendationActionsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of recommendation action advisors. - Value *[]RecommendationAction `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendationActionsResultList. -func (rarl RecommendationActionsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecommendationActionsResultListIterator provides access to a complete listing of RecommendationAction -// values. -type RecommendationActionsResultListIterator struct { - i int - page RecommendationActionsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RecommendationActionsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RecommendationActionsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecommendationActionsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RecommendationActionsResultListIterator) Response() RecommendationActionsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RecommendationActionsResultListIterator) Value() RecommendationAction { - if !iter.page.NotDone() { - return RecommendationAction{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecommendationActionsResultListIterator type. -func NewRecommendationActionsResultListIterator(page RecommendationActionsResultListPage) RecommendationActionsResultListIterator { - return RecommendationActionsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rarl RecommendationActionsResultList) IsEmpty() bool { - return rarl.Value == nil || len(*rarl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rarl RecommendationActionsResultList) hasNextLink() bool { - return rarl.NextLink != nil && len(*rarl.NextLink) != 0 -} - -// recommendationActionsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rarl RecommendationActionsResultList) recommendationActionsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !rarl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rarl.NextLink))) -} - -// RecommendationActionsResultListPage contains a page of RecommendationAction values. -type RecommendationActionsResultListPage struct { - fn func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error) - rarl RecommendationActionsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RecommendationActionsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rarl) - if err != nil { - return err - } - page.rarl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RecommendationActionsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecommendationActionsResultListPage) NotDone() bool { - return !page.rarl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecommendationActionsResultListPage) Response() RecommendationActionsResultList { - return page.rarl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecommendationActionsResultListPage) Values() []RecommendationAction { - if page.rarl.IsEmpty() { - return nil - } - return *page.rarl.Value -} - -// Creates a new instance of the RecommendationActionsResultListPage type. -func NewRecommendationActionsResultListPage(cur RecommendationActionsResultList, getNextPage func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)) RecommendationActionsResultListPage { - return RecommendationActionsResultListPage{ - fn: getNextPage, - rarl: cur, - } -} - -// RecommendedActionSessionsOperationStatus recommendation action session operation status. -type RecommendedActionSessionsOperationStatus struct { - autorest.Response `json:"-"` - // Name - Operation identifier. - Name *string `json:"name,omitempty"` - // StartTime - Operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // Status - Operation status. - Status *string `json:"status,omitempty"` -} - -// RecoverableServerProperties the recoverable server's properties. -type RecoverableServerProperties struct { - // LastAvailableBackupDateTime - READ-ONLY; The last available backup date time. - LastAvailableBackupDateTime *string `json:"lastAvailableBackupDateTime,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // Edition - READ-ONLY; Edition of the performance tier. - Edition *string `json:"edition,omitempty"` - // VCore - READ-ONLY; vCore associated with the service level objective - VCore *int32 `json:"vCore,omitempty"` - // HardwareGeneration - READ-ONLY; Hardware generation associated with the service level objective - HardwareGeneration *string `json:"hardwareGeneration,omitempty"` - // Version - READ-ONLY; The MySQL version - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableServerProperties. -func (rsp RecoverableServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableServerResource a recoverable server resource. -type RecoverableServerResource struct { - autorest.Response `json:"-"` - // RecoverableServerProperties - Resource properties. - *RecoverableServerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableServerResource. -func (rsr RecoverableServerResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsr.RecoverableServerProperties != nil { - objectMap["properties"] = rsr.RecoverableServerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableServerResource struct. -func (rsr *RecoverableServerResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recoverableServerProperties RecoverableServerProperties - err = json.Unmarshal(*v, &recoverableServerProperties) - if err != nil { - return err - } - rsr.RecoverableServerProperties = &recoverableServerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rsr.Type = &typeVar - } - } - } - - return nil -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity azure Active Directory identity configuration for a resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; The Azure Active Directory principal id. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' - Type IdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; The Azure Active Directory tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != "" { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// SecurityAlertPolicyProperties properties of a security alert policy. -type SecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled' - State ServerSecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// Server represents a server. -type Server struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerProperties - Properties of the server. - *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Identity != nil { - objectMap["identity"] = s.Identity - } - if s.Sku != nil { - objectMap["sku"] = s.Sku - } - if s.ServerProperties != nil { - objectMap["properties"] = s.ServerProperties - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - if s.Location != nil { - objectMap["location"] = s.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Server struct. -func (s *Server) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - s.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - s.Sku = &sku - } - case "properties": - if v != nil { - var serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - s.ServerProperties = &serverProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ServerAdministratorProperties the properties of an server Administrator. -type ServerAdministratorProperties struct { - // AdministratorType - The type of administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - The server administrator login account name. - Login *string `json:"login,omitempty"` - // Sid - The server administrator Sid (Secure ID). - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - The server Active Directory Administrator tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ServerAdministratorResource represents a and external administrator to be created. -type ServerAdministratorResource struct { - autorest.Response `json:"-"` - // ServerAdministratorProperties - Properties of the server AAD administrator. - *ServerAdministratorProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerAdministratorResource. -func (sar ServerAdministratorResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sar.ServerAdministratorProperties != nil { - objectMap["properties"] = sar.ServerAdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerAdministratorResource struct. -func (sar *ServerAdministratorResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serverAdministratorProperties ServerAdministratorProperties - err = json.Unmarshal(*v, &serverAdministratorProperties) - if err != nil { - return err - } - sar.ServerAdministratorProperties = &serverAdministratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sar.Type = &typeVar - } - } - } - - return nil -} - -// ServerAdministratorResourceListResult the response to a list Active Directory Administrators request. -type ServerAdministratorResourceListResult struct { - autorest.Response `json:"-"` - // Value - The list of server Active Directory Administrators for the server. - Value *[]ServerAdministratorResource `json:"value,omitempty"` -} - -// ServerAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerAdministratorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAdministratorsClient) (ServerAdministratorResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerAdministratorsCreateOrUpdateFuture.Result. -func (future *ServerAdministratorsCreateOrUpdateFuture) result(client ServerAdministratorsClient) (sar ServerAdministratorResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServerAdministratorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sar.Response.Response, err = future.GetResult(sender); err == nil && sar.Response.Response.StatusCode != http.StatusNoContent { - sar, err = client.CreateOrUpdateResponder(sar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsCreateOrUpdateFuture", "Result", sar.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerAdministratorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAdministratorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerAdministratorsDeleteFuture.Result. -func (future *ServerAdministratorsDeleteFuture) result(client ServerAdministratorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServerAdministratorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerForCreate represents a server to be created. -type ServerForCreate struct { - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // Properties - Properties of the server. - Properties BasicServerPropertiesForCreate `json:"properties,omitempty"` - // Location - The location the resource resides in. - Location *string `json:"location,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerForCreate. -func (sfc ServerForCreate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sfc.Identity != nil { - objectMap["identity"] = sfc.Identity - } - if sfc.Sku != nil { - objectMap["sku"] = sfc.Sku - } - objectMap["properties"] = sfc.Properties - if sfc.Location != nil { - objectMap["location"] = sfc.Location - } - if sfc.Tags != nil { - objectMap["tags"] = sfc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerForCreate struct. -func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sfc.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sfc.Sku = &sku - } - case "properties": - if v != nil { - properties, err := unmarshalBasicServerPropertiesForCreate(*v) - if err != nil { - return err - } - sfc.Properties = properties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sfc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sfc.Tags = tags - } - } - } - - return nil -} - -// ServerKey a MySQL Server key. -type ServerKey struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector used to protect the key. - Kind *string `json:"kind,omitempty"` - // ServerKeyProperties - Properties of the ServerKey Resource. - *ServerKeyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKey. -func (sk ServerKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sk.ServerKeyProperties != nil { - objectMap["properties"] = sk.ServerKeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerKey struct. -func (sk *ServerKey) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sk.Kind = &kind - } - case "properties": - if v != nil { - var serverKeyProperties ServerKeyProperties - err = json.Unmarshal(*v, &serverKeyProperties) - if err != nil { - return err - } - sk.ServerKeyProperties = &serverKeyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sk.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sk.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sk.Type = &typeVar - } - } - } - - return nil -} - -// ServerKeyListResult a list of MySQL Server keys. -type ServerKeyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of MySQL Server keys. - Value *[]ServerKey `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyListResult. -func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. -type ServerKeyListResultIterator struct { - i int - page ServerKeyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServerKeyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerKeyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServerKeyListResultIterator) Response() ServerKeyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServerKeyListResultIterator) Value() ServerKey { - if !iter.page.NotDone() { - return ServerKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerKeyListResultIterator type. -func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { - return ServerKeyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sklr ServerKeyListResult) IsEmpty() bool { - return sklr.Value == nil || len(*sklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sklr ServerKeyListResult) hasNextLink() bool { - return sklr.NextLink != nil && len(*sklr.NextLink) != 0 -} - -// serverKeyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sklr.NextLink))) -} - -// ServerKeyListResultPage contains a page of ServerKey values. -type ServerKeyListResultPage struct { - fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) - sklr ServerKeyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sklr) - if err != nil { - return err - } - page.sklr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServerKeyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerKeyListResultPage) NotDone() bool { - return !page.sklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerKeyListResultPage) Response() ServerKeyListResult { - return page.sklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerKeyListResultPage) Values() []ServerKey { - if page.sklr.IsEmpty() { - return nil - } - return *page.sklr.Value -} - -// Creates a new instance of the ServerKeyListResultPage type. -func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { - return ServerKeyListResultPage{ - fn: getNextPage, - sklr: cur, - } -} - -// ServerKeyProperties properties for a key execution. -type ServerKeyProperties struct { - // ServerKeyType - The key type like 'AzureKeyVault'. - ServerKeyType *string `json:"serverKeyType,omitempty"` - // URI - The URI of the key. - URI *string `json:"uri,omitempty"` - // CreationDate - READ-ONLY; The key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyProperties. -func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if skp.ServerKeyType != nil { - objectMap["serverKeyType"] = skp.ServerKeyType - } - if skp.URI != nil { - objectMap["uri"] = skp.URI - } - return json.Marshal(objectMap) -} - -// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerKeysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (ServerKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerKeysCreateOrUpdateFuture.Result. -func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sk.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServerKeysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { - sk, err = client.CreateOrUpdateResponder(sk.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerKeysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerKeysDeleteFuture.Result. -func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServerKeysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerListResult a list of servers. -type ServerListResult struct { - autorest.Response `json:"-"` - // Value - The list of servers - Value *[]Server `json:"value,omitempty"` -} - -// ServerParametersListUpdateConfigurationsFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerParametersListUpdateConfigurationsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerParametersClient) (ConfigurationListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerParametersListUpdateConfigurationsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerParametersListUpdateConfigurationsFuture.Result. -func (future *ServerParametersListUpdateConfigurationsFuture) result(client ServerParametersClient) (clr ConfigurationListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerParametersListUpdateConfigurationsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - clr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServerParametersListUpdateConfigurationsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if clr.Response.Response, err = future.GetResult(sender); err == nil && clr.Response.Response.StatusCode != http.StatusNoContent { - clr, err = client.ListUpdateConfigurationsResponder(clr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerParametersListUpdateConfigurationsFuture", "Result", clr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerPrivateEndpointConnection a private endpoint connection under a server -type ServerPrivateEndpointConnection struct { - // ID - READ-ONLY; Resource Id of the private endpoint connection. - ID *string `json:"id,omitempty"` - // Properties - READ-ONLY; Private endpoint connection properties - Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnection. -func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerPrivateEndpointConnectionProperties properties of a private endpoint connection. -type ServerPrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting' - ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnectionProperties. -func (specp ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if specp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = specp.PrivateEndpoint - } - if specp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = specp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// ServerPrivateLinkServiceConnectionStateProperty ... -type ServerPrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'None' - ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateLinkServiceConnectionStateProperty. -func (splscsp ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if splscsp.Status != "" { - objectMap["status"] = splscsp.Status - } - if splscsp.Description != nil { - objectMap["description"] = splscsp.Description - } - return json.Marshal(objectMap) -} - -// ServerProperties the properties of a server. -type ServerProperties struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // ByokEnforcement - READ-ONLY; Status showing whether the server data encryption is enabled with customer-managed keys. - ByokEnforcement *string `json:"byokEnforcement,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateInaccessible' - UserVisibleState ServerState `json:"userVisibleState,omitempty"` - // FullyQualifiedDomainName - The fully qualified domain name of a server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // EarliestRestoreDate - Earliest restore point creation time (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // ReplicationRole - The replication role of the server. - ReplicationRole *string `json:"replicationRole,omitempty"` - // MasterServerID - The master server id of a replica server. - MasterServerID *string `json:"masterServerId,omitempty"` - // ReplicaCapacity - The maximum number of replicas that a master server can have. - ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server - PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.AdministratorLogin != nil { - objectMap["administratorLogin"] = sp.AdministratorLogin - } - if sp.Version != "" { - objectMap["version"] = sp.Version - } - if sp.SslEnforcement != "" { - objectMap["sslEnforcement"] = sp.SslEnforcement - } - if sp.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = sp.MinimalTLSVersion - } - if sp.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = sp.InfrastructureEncryption - } - if sp.UserVisibleState != "" { - objectMap["userVisibleState"] = sp.UserVisibleState - } - if sp.FullyQualifiedDomainName != nil { - objectMap["fullyQualifiedDomainName"] = sp.FullyQualifiedDomainName - } - if sp.EarliestRestoreDate != nil { - objectMap["earliestRestoreDate"] = sp.EarliestRestoreDate - } - if sp.StorageProfile != nil { - objectMap["storageProfile"] = sp.StorageProfile - } - if sp.ReplicationRole != nil { - objectMap["replicationRole"] = sp.ReplicationRole - } - if sp.MasterServerID != nil { - objectMap["masterServerId"] = sp.MasterServerID - } - if sp.ReplicaCapacity != nil { - objectMap["replicaCapacity"] = sp.ReplicaCapacity - } - if sp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// BasicServerPropertiesForCreate the properties used to create a new server. -type BasicServerPropertiesForCreate interface { - AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) - AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) - AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) - AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) - AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) -} - -// ServerPropertiesForCreate the properties used to create a new server. -type ServerPropertiesForCreate struct { - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["createMode"] { - case string(CreateModeDefault): - var spfdc ServerPropertiesForDefaultCreate - err := json.Unmarshal(body, &spfdc) - return spfdc, err - case string(CreateModePointInTimeRestore): - var spfr ServerPropertiesForRestore - err := json.Unmarshal(body, &spfr) - return spfr, err - case string(CreateModeGeoRestore): - var spfgr ServerPropertiesForGeoRestore - err := json.Unmarshal(body, &spfgr) - return spfgr, err - case string(CreateModeReplica): - var spfr ServerPropertiesForReplica - err := json.Unmarshal(body, &spfr) - return spfr, err - default: - var spfc ServerPropertiesForCreate - err := json.Unmarshal(body, &spfc) - return spfc, err - } -} -func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages)) - - for index, rawMessage := range rawMessages { - spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage) - if err != nil { - return nil, err - } - spfcArray[index] = spfc - } - return spfcArray, nil -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { - spfc.CreateMode = CreateModeServerPropertiesForCreate - objectMap := make(map[string]interface{}) - if spfc.Version != "" { - objectMap["version"] = spfc.Version - } - if spfc.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfc.SslEnforcement - } - if spfc.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfc.MinimalTLSVersion - } - if spfc.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfc.InfrastructureEncryption - } - if spfc.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess - } - if spfc.StorageProfile != nil { - objectMap["storageProfile"] = spfc.StorageProfile - } - if spfc.CreateMode != "" { - objectMap["createMode"] = spfc.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return &spfc, true -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfc, true -} - -// ServerPropertiesForDefaultCreate the properties used to create a new server. -type ServerPropertiesForDefaultCreate struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { - spfdc.CreateMode = CreateModeDefault - objectMap := make(map[string]interface{}) - if spfdc.AdministratorLogin != nil { - objectMap["administratorLogin"] = spfdc.AdministratorLogin - } - if spfdc.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword - } - if spfdc.Version != "" { - objectMap["version"] = spfdc.Version - } - if spfdc.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfdc.SslEnforcement - } - if spfdc.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfdc.MinimalTLSVersion - } - if spfdc.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfdc.InfrastructureEncryption - } - if spfdc.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess - } - if spfdc.StorageProfile != nil { - objectMap["storageProfile"] = spfdc.StorageProfile - } - if spfdc.CreateMode != "" { - objectMap["createMode"] = spfdc.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return &spfdc, true -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfdc, true -} - -// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different -// region from a geo replicated backup. -type ServerPropertiesForGeoRestore struct { - // SourceServerID - The source server id to restore from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { - spfgr.CreateMode = CreateModeGeoRestore - objectMap := make(map[string]interface{}) - if spfgr.SourceServerID != nil { - objectMap["sourceServerId"] = spfgr.SourceServerID - } - if spfgr.Version != "" { - objectMap["version"] = spfgr.Version - } - if spfgr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfgr.SslEnforcement - } - if spfgr.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfgr.MinimalTLSVersion - } - if spfgr.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfgr.InfrastructureEncryption - } - if spfgr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess - } - if spfgr.StorageProfile != nil { - objectMap["storageProfile"] = spfgr.StorageProfile - } - if spfgr.CreateMode != "" { - objectMap["createMode"] = spfgr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return &spfgr, true -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfgr, true -} - -// ServerPropertiesForReplica the properties to create a new replica. -type ServerPropertiesForReplica struct { - // SourceServerID - The master server id to create replica from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { - spfr.CreateMode = CreateModeReplica - objectMap := make(map[string]interface{}) - if spfr.SourceServerID != nil { - objectMap["sourceServerId"] = spfr.SourceServerID - } - if spfr.Version != "" { - objectMap["version"] = spfr.Version - } - if spfr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfr.SslEnforcement - } - if spfr.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion - } - if spfr.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption - } - if spfr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess - } - if spfr.StorageProfile != nil { - objectMap["storageProfile"] = spfr.StorageProfile - } - if spfr.CreateMode != "" { - objectMap["createMode"] = spfr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return &spfr, true -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfr, true -} - -// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup. -type ServerPropertiesForRestore struct { - // SourceServerID - The source server id to restore from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { - spfr.CreateMode = CreateModePointInTimeRestore - objectMap := make(map[string]interface{}) - if spfr.SourceServerID != nil { - objectMap["sourceServerId"] = spfr.SourceServerID - } - if spfr.RestorePointInTime != nil { - objectMap["restorePointInTime"] = spfr.RestorePointInTime - } - if spfr.Version != "" { - objectMap["version"] = spfr.Version - } - if spfr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfr.SslEnforcement - } - if spfr.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion - } - if spfr.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption - } - if spfr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess - } - if spfr.StorageProfile != nil { - objectMap["storageProfile"] = spfr.StorageProfile - } - if spfr.CreateMode != "" { - objectMap["createMode"] = spfr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return &spfr, true -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfr, true -} - -// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersCreateFuture.Result. -func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerSecurityAlertPolicy a server security alert policy. -type ServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = ssap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ssap.Type = &typeVar - } - } - } - - return nil -} - -// ServerSecurityAlertPolicyListResult a list of the server's security alert policies. -type ServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyListResult. -func (ssaplr ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultIterator struct { - i int - page ServerSecurityAlertPolicyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServerSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerSecurityAlertPolicyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServerSecurityAlertPolicyListResultIterator) Response() ServerSecurityAlertPolicyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { - if !iter.page.NotDone() { - return ServerSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultIterator type. -func NewServerSecurityAlertPolicyListResultIterator(page ServerSecurityAlertPolicyListResultPage) ServerSecurityAlertPolicyListResultIterator { - return ServerSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssaplr ServerSecurityAlertPolicyListResult) IsEmpty() bool { - return ssaplr.Value == nil || len(*ssaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssaplr ServerSecurityAlertPolicyListResult) hasNextLink() bool { - return ssaplr.NextLink != nil && len(*ssaplr.NextLink) != 0 -} - -// serverSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssaplr ServerSecurityAlertPolicyListResult) serverSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ssaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssaplr.NextLink))) -} - -// ServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error) - ssaplr ServerSecurityAlertPolicyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssaplr) - if err != nil { - return err - } - page.ssaplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServerSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.ssaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerSecurityAlertPolicyListResultPage) Response() ServerSecurityAlertPolicyListResult { - return page.ssaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { - if page.ssaplr.IsEmpty() { - return nil - } - return *page.ssaplr.Value -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultPage type. -func NewServerSecurityAlertPolicyListResultPage(cur ServerSecurityAlertPolicyListResult, getNextPage func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error)) ServerSecurityAlertPolicyListResultPage { - return ServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - ssaplr: cur, - } -} - -// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersRestartFuture.Result. -func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ServersStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersStartFuture.Result. -func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ServersStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersStopFuture.Result. -func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersUpgradeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpgradeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpgradeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersUpgradeFuture.Result. -func (future *ServersUpgradeFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersUpgradeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.ServersUpgradeFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerUpdateParameters parameters allowed to update for a server. -type ServerUpdateParameters struct { - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerUpdateParametersProperties - The properties that can be updated for a server. - *ServerUpdateParametersProperties `json:"properties,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerUpdateParameters. -func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.Identity != nil { - objectMap["identity"] = sup.Identity - } - if sup.Sku != nil { - objectMap["sku"] = sup.Sku - } - if sup.ServerUpdateParametersProperties != nil { - objectMap["properties"] = sup.ServerUpdateParametersProperties - } - if sup.Tags != nil { - objectMap["tags"] = sup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct. -func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sup.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sup.Sku = &sku - } - case "properties": - if v != nil { - var serverUpdateParametersProperties ServerUpdateParametersProperties - err = json.Unmarshal(*v, &serverUpdateParametersProperties) - if err != nil { - return err - } - sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sup.Tags = tags - } - } - } - - return nil -} - -// ServerUpdateParametersProperties the properties that can be updated for a server. -type ServerUpdateParametersProperties struct { - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - The version of a server. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // ReplicationRole - The replication role of the server. - ReplicationRole *string `json:"replicationRole,omitempty"` -} - -// ServerUpgradeParameters ... -type ServerUpgradeParameters struct { - // ServerUpgradeParametersProperties - The properties that can be updated for a server. - *ServerUpgradeParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUpgradeParameters. -func (sup ServerUpgradeParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.ServerUpgradeParametersProperties != nil { - objectMap["properties"] = sup.ServerUpgradeParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerUpgradeParameters struct. -func (sup *ServerUpgradeParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serverUpgradeParametersProperties ServerUpgradeParametersProperties - err = json.Unmarshal(*v, &serverUpgradeParametersProperties) - if err != nil { - return err - } - sup.ServerUpgradeParametersProperties = &serverUpgradeParametersProperties - } - } - } - - return nil -} - -// ServerUpgradeParametersProperties the properties that can be updated for a server. -type ServerUpgradeParametersProperties struct { - // TargetServerVersion - Represents an server storage profile. - TargetServerVersion *string `json:"targetServerVersion,omitempty"` -} - -// Sku billing information related properties of a server. -type Sku struct { - // Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. - Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' - Tier SkuTier `json:"tier,omitempty"` - // Capacity - The scale up/out capacity, representing server's compute units. - Capacity *int32 `json:"capacity,omitempty"` - // Size - The size code, to be interpreted by resource as appropriate. - Size *string `json:"size,omitempty"` - // Family - The family of hardware. - Family *string `json:"family,omitempty"` -} - -// StorageProfile storage Profile properties of a server -type StorageProfile struct { - // BackupRetentionDays - Backup retention days for the server. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - // GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled' - GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` - // StorageMB - Max storage allowed for a server. - StorageMB *int32 `json:"storageMB,omitempty"` - // StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled' - StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"` -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// TopQueryStatisticsInput input to get top query statistics -type TopQueryStatisticsInput struct { - // TopQueryStatisticsInputProperties - The properties of a wait statistics input. - *TopQueryStatisticsInputProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopQueryStatisticsInput. -func (tqsi TopQueryStatisticsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tqsi.TopQueryStatisticsInputProperties != nil { - objectMap["properties"] = tqsi.TopQueryStatisticsInputProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopQueryStatisticsInput struct. -func (tqsi *TopQueryStatisticsInput) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var topQueryStatisticsInputProperties TopQueryStatisticsInputProperties - err = json.Unmarshal(*v, &topQueryStatisticsInputProperties) - if err != nil { - return err - } - tqsi.TopQueryStatisticsInputProperties = &topQueryStatisticsInputProperties - } - } - } - - return nil -} - -// TopQueryStatisticsInputProperties the properties for input to get top query statistics -type TopQueryStatisticsInputProperties struct { - // NumberOfTopQueries - Max number of top queries to return. - NumberOfTopQueries *int32 `json:"numberOfTopQueries,omitempty"` - // AggregationFunction - Aggregation function name. - AggregationFunction *string `json:"aggregationFunction,omitempty"` - // ObservedMetric - Observed metric name. - ObservedMetric *string `json:"observedMetric,omitempty"` - // ObservationStartTime - Observation start time. - ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` - // ObservationEndTime - Observation end time. - ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` - // AggregationWindow - Aggregation interval type in ISO 8601 format. - AggregationWindow *string `json:"aggregationWindow,omitempty"` -} - -// TopQueryStatisticsResultList a list of query statistics. -type TopQueryStatisticsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of top query statistics. - Value *[]QueryStatistic `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopQueryStatisticsResultList. -func (tqsrl TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopQueryStatisticsResultListIterator provides access to a complete listing of QueryStatistic values. -type TopQueryStatisticsResultListIterator struct { - i int - page TopQueryStatisticsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TopQueryStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TopQueryStatisticsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TopQueryStatisticsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TopQueryStatisticsResultListIterator) Response() TopQueryStatisticsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TopQueryStatisticsResultListIterator) Value() QueryStatistic { - if !iter.page.NotDone() { - return QueryStatistic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TopQueryStatisticsResultListIterator type. -func NewTopQueryStatisticsResultListIterator(page TopQueryStatisticsResultListPage) TopQueryStatisticsResultListIterator { - return TopQueryStatisticsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tqsrl TopQueryStatisticsResultList) IsEmpty() bool { - return tqsrl.Value == nil || len(*tqsrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tqsrl TopQueryStatisticsResultList) hasNextLink() bool { - return tqsrl.NextLink != nil && len(*tqsrl.NextLink) != 0 -} - -// topQueryStatisticsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tqsrl TopQueryStatisticsResultList) topQueryStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !tqsrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tqsrl.NextLink))) -} - -// TopQueryStatisticsResultListPage contains a page of QueryStatistic values. -type TopQueryStatisticsResultListPage struct { - fn func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error) - tqsrl TopQueryStatisticsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TopQueryStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tqsrl) - if err != nil { - return err - } - page.tqsrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TopQueryStatisticsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TopQueryStatisticsResultListPage) NotDone() bool { - return !page.tqsrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TopQueryStatisticsResultListPage) Response() TopQueryStatisticsResultList { - return page.tqsrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TopQueryStatisticsResultListPage) Values() []QueryStatistic { - if page.tqsrl.IsEmpty() { - return nil - } - return *page.tqsrl.Value -} - -// Creates a new instance of the TopQueryStatisticsResultListPage type. -func NewTopQueryStatisticsResultListPage(cur TopQueryStatisticsResultList, getNextPage func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)) TopQueryStatisticsResultListPage { - return TopQueryStatisticsResultListPage{ - fn: getNextPage, - tqsrl: cur, - } -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRule a virtual network rule. -type VirtualNetworkRule struct { - autorest.Response `json:"-"` - // VirtualNetworkRuleProperties - Resource properties. - *VirtualNetworkRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRule. -func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnr.VirtualNetworkRuleProperties != nil { - objectMap["properties"] = vnr.VirtualNetworkRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. -func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkRuleProperties VirtualNetworkRuleProperties - err = json.Unmarshal(*v, &virtualNetworkRuleProperties) - if err != nil { - return err - } - vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnr.Type = &typeVar - } - } - } - - return nil -} - -// VirtualNetworkRuleListResult a list of virtual network rules. -type VirtualNetworkRuleListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualNetworkRule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. -func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. -type VirtualNetworkRuleListResultIterator struct { - i int - page VirtualNetworkRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { - if !iter.page.NotDone() { - return VirtualNetworkRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkRuleListResultIterator type. -func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { - return VirtualNetworkRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { - return vnrlr.Value == nil || len(*vnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { - return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 -} - -// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnrlr.NextLink))) -} - -// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. -type VirtualNetworkRuleListResultPage struct { - fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) - vnrlr VirtualNetworkRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnrlr) - if err != nil { - return err - } - page.vnrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkRuleListResultPage) NotDone() bool { - return !page.vnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { - return page.vnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { - if page.vnrlr.IsEmpty() { - return nil - } - return *page.vnrlr.Value -} - -// Creates a new instance of the VirtualNetworkRuleListResultPage type. -func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { - return VirtualNetworkRuleListResultPage{ - fn: getNextPage, - vnrlr: cur, - } -} - -// VirtualNetworkRuleProperties properties of a virtual network rule. -type VirtualNetworkRuleProperties struct { - // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. - VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' - State VirtualNetworkRuleState `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. -func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnrp.VirtualNetworkSubnetID != nil { - objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID - } - if vnrp.IgnoreMissingVnetServiceEndpoint != nil { - objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkRulesCreateOrUpdateFuture.Result. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.VirtualNetworkRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { - vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkRulesDeleteFuture.Result. -func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mysql.VirtualNetworkRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WaitStatistic represents a Wait Statistic. -type WaitStatistic struct { - autorest.Response `json:"-"` - // WaitStatisticProperties - The properties of a wait statistic. - *WaitStatisticProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatistic. -func (ws WaitStatistic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ws.WaitStatisticProperties != nil { - objectMap["properties"] = ws.WaitStatisticProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WaitStatistic struct. -func (ws *WaitStatistic) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var waitStatisticProperties WaitStatisticProperties - err = json.Unmarshal(*v, &waitStatisticProperties) - if err != nil { - return err - } - ws.WaitStatisticProperties = &waitStatisticProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ws.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ws.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ws.Type = &typeVar - } - } - } - - return nil -} - -// WaitStatisticProperties the properties of a wait statistic. -type WaitStatisticProperties struct { - // StartTime - Observation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Observation end time. - EndTime *date.Time `json:"endTime,omitempty"` - // EventName - Wait event name. - EventName *string `json:"eventName,omitempty"` - // EventTypeName - Wait event type name. - EventTypeName *string `json:"eventTypeName,omitempty"` - // QueryID - Database query identifier. - QueryID *int64 `json:"queryId,omitempty"` - // DatabaseName - Database Name. - DatabaseName *string `json:"databaseName,omitempty"` - // UserID - Database user identifier. - UserID *int64 `json:"userId,omitempty"` - // Count - Wait event count observed in this time interval. - Count *int64 `json:"count,omitempty"` - // TotalTimeInMs - Total time of wait in milliseconds in this time interval. - TotalTimeInMs *float64 `json:"totalTimeInMs,omitempty"` -} - -// WaitStatisticsInput input to get wait statistics -type WaitStatisticsInput struct { - // WaitStatisticsInputProperties - The properties of a wait statistics input. - *WaitStatisticsInputProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatisticsInput. -func (wsi WaitStatisticsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wsi.WaitStatisticsInputProperties != nil { - objectMap["properties"] = wsi.WaitStatisticsInputProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WaitStatisticsInput struct. -func (wsi *WaitStatisticsInput) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var waitStatisticsInputProperties WaitStatisticsInputProperties - err = json.Unmarshal(*v, &waitStatisticsInputProperties) - if err != nil { - return err - } - wsi.WaitStatisticsInputProperties = &waitStatisticsInputProperties - } - } - } - - return nil -} - -// WaitStatisticsInputProperties the properties for input to get wait statistics -type WaitStatisticsInputProperties struct { - // ObservationStartTime - Observation start time. - ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` - // ObservationEndTime - Observation end time. - ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` - // AggregationWindow - Aggregation interval type in ISO 8601 format. - AggregationWindow *string `json:"aggregationWindow,omitempty"` -} - -// WaitStatisticsResultList a list of wait statistics. -type WaitStatisticsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of wait statistics. - Value *[]WaitStatistic `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatisticsResultList. -func (wsrl WaitStatisticsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WaitStatisticsResultListIterator provides access to a complete listing of WaitStatistic values. -type WaitStatisticsResultListIterator struct { - i int - page WaitStatisticsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WaitStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WaitStatisticsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WaitStatisticsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WaitStatisticsResultListIterator) Response() WaitStatisticsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WaitStatisticsResultListIterator) Value() WaitStatistic { - if !iter.page.NotDone() { - return WaitStatistic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WaitStatisticsResultListIterator type. -func NewWaitStatisticsResultListIterator(page WaitStatisticsResultListPage) WaitStatisticsResultListIterator { - return WaitStatisticsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wsrl WaitStatisticsResultList) IsEmpty() bool { - return wsrl.Value == nil || len(*wsrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wsrl WaitStatisticsResultList) hasNextLink() bool { - return wsrl.NextLink != nil && len(*wsrl.NextLink) != 0 -} - -// waitStatisticsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wsrl WaitStatisticsResultList) waitStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !wsrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wsrl.NextLink))) -} - -// WaitStatisticsResultListPage contains a page of WaitStatistic values. -type WaitStatisticsResultListPage struct { - fn func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error) - wsrl WaitStatisticsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WaitStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wsrl) - if err != nil { - return err - } - page.wsrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WaitStatisticsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WaitStatisticsResultListPage) NotDone() bool { - return !page.wsrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WaitStatisticsResultListPage) Response() WaitStatisticsResultList { - return page.wsrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WaitStatisticsResultListPage) Values() []WaitStatistic { - if page.wsrl.IsEmpty() { - return nil - } - return *page.wsrl.Value -} - -// Creates a new instance of the WaitStatisticsResultListPage type. -func NewWaitStatisticsResultListPage(cur WaitStatisticsResultList, getNextPage func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)) WaitStatisticsResultListPage { - return WaitStatisticsResultListPage{ - fn: getNextPage, - wsrl: cur, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/operations.go deleted file mode 100644 index 60e864ef1d71..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/operations.go +++ /dev/null @@ -1,100 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DBforMySQL/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privateendpointconnections.go deleted file mode 100644 index 847bacd41067..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privateendpointconnections.go +++ /dev/null @@ -1,527 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets all private endpoint connections on a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateEndpointConnectionsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateEndpointConnectionsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByServerResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByServerNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// UpdateTags updates private endpoint connection with the specified tags. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - parameters supplied to the Update private endpoint connection Tags operation. -func (client PrivateEndpointConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject) (result PrivateEndpointConnectionsUpdateTagsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateTags") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateEndpointConnectionsClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTagsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsClient", "UpdateTags", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client PrivateEndpointConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateTagsSender(req *http.Request) (future PrivateEndpointConnectionsUpdateTagsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateTagsResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privatelinkresources.go deleted file mode 100644 index a69eea528014..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/privatelinkresources.go +++ /dev/null @@ -1,249 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a private link resource for MySQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateLinkResources/{groupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets the private link resources for MySQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateLinkResourcesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.PrivateLinkResourcesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateLinkResourcesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByServerResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByServerNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/querytexts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/querytexts.go deleted file mode 100644 index 2f7093967e24..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/querytexts.go +++ /dev/null @@ -1,252 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QueryTextsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type QueryTextsClient struct { - BaseClient -} - -// NewQueryTextsClient creates an instance of the QueryTextsClient client. -func NewQueryTextsClient(subscriptionID string) QueryTextsClient { - return NewQueryTextsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueryTextsClientWithBaseURI creates an instance of the QueryTextsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewQueryTextsClientWithBaseURI(baseURI string, subscriptionID string) QueryTextsClient { - return QueryTextsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the Query-Store query texts for the queryId. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// queryID - the Query-Store query identifier. -func (client QueryTextsClient) Get(ctx context.Context, resourceGroupName string, serverName string, queryID string) (result QueryText, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.QueryTextsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, queryID) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QueryTextsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, queryID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "queryId": autorest.Encode("path", queryID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/queryTexts/{queryId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QueryTextsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QueryTextsClient) GetResponder(resp *http.Response) (result QueryText, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve the Query-Store query texts for specified queryIds. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// queryIds - the query identifiers -func (client QueryTextsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, queryIds []string) (result QueryTextsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.ListByServer") - defer func() { - sc := -1 - if result.qtrl.Response.Response != nil { - sc = result.qtrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: queryIds, - Constraints: []validation.Constraint{{Target: "queryIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.QueryTextsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, queryIds) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.qtrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.qtrl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.qtrl.hasNextLink() && result.qtrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client QueryTextsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, queryIds []string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "queryIds": queryIds, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/queryTexts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client QueryTextsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client QueryTextsClient) ListByServerResponder(resp *http.Response) (result QueryTextsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client QueryTextsClient) listByServerNextResults(ctx context.Context, lastResults QueryTextsResultList) (result QueryTextsResultList, err error) { - req, err := lastResults.queryTextsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.QueryTextsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client QueryTextsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, queryIds []string) (result QueryTextsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, queryIds) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recommendedactions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recommendedactions.go deleted file mode 100644 index a7e91744758c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recommendedactions.go +++ /dev/null @@ -1,257 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RecommendedActionsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type RecommendedActionsClient struct { - BaseClient -} - -// NewRecommendedActionsClient creates an instance of the RecommendedActionsClient client. -func NewRecommendedActionsClient(subscriptionID string) RecommendedActionsClient { - return NewRecommendedActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecommendedActionsClientWithBaseURI creates an instance of the RecommendedActionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRecommendedActionsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedActionsClient { - return RecommendedActionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve recommended actions from the advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -// recommendedActionName - the recommended action name. -func (client RecommendedActionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string, recommendedActionName string) (result RecommendationAction, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedActionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.RecommendedActionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, advisorName, recommendedActionName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecommendedActionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, recommendedActionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "recommendedActionName": autorest.Encode("path", recommendedActionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedActionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecommendedActionsClient) GetResponder(resp *http.Response) (result RecommendationAction, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve recommended actions from the advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -// sessionID - the recommendation action session identifier. -func (client RecommendedActionsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, sessionID string) (result RecommendationActionsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedActionsClient.ListByServer") - defer func() { - sc := -1 - if result.rarl.Response.Response != nil { - sc = result.rarl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.RecommendedActionsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, advisorName, sessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.rarl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.rarl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.rarl.hasNextLink() && result.rarl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecommendedActionsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, sessionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(sessionID) > 0 { - queryParameters["sessionId"] = autorest.Encode("query", sessionID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedActionsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecommendedActionsClient) ListByServerResponder(resp *http.Response) (result RecommendationActionsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client RecommendedActionsClient) listByServerNextResults(ctx context.Context, lastResults RecommendationActionsResultList) (result RecommendationActionsResultList, err error) { - req, err := lastResults.recommendationActionsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecommendedActionsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecommendedActionsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, advisorName string, sessionID string) (result RecommendationActionsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedActionsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, advisorName, sessionID) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recoverableservers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recoverableservers.go deleted file mode 100644 index d4fc92054935..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/recoverableservers.go +++ /dev/null @@ -1,120 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RecoverableServersClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type RecoverableServersClient struct { - BaseClient -} - -// NewRecoverableServersClient creates an instance of the RecoverableServersClient client. -func NewRecoverableServersClient(subscriptionID string) RecoverableServersClient { - return NewRecoverableServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoverableServersClientWithBaseURI creates an instance of the RecoverableServersClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRecoverableServersClientWithBaseURI(baseURI string, subscriptionID string) RecoverableServersClient { - return RecoverableServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recoverable MySQL Server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client RecoverableServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result RecoverableServerResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableServersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.RecoverableServersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecoverableServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.RecoverableServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.RecoverableServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoverableServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/recoverableServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecoverableServersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecoverableServersClient) GetResponder(resp *http.Response) (result RecoverableServerResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/replicas.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/replicas.go deleted file mode 100644 index 4ee45727f179..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/replicas.go +++ /dev/null @@ -1,119 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReplicasClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type ReplicasClient struct { - BaseClient -} - -// NewReplicasClient creates an instance of the ReplicasClient client. -func NewReplicasClient(subscriptionID string) ReplicasClient { - return NewReplicasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicasClientWithBaseURI creates an instance of the ReplicasClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewReplicasClientWithBaseURI(baseURI string, subscriptionID string) ReplicasClient { - return ReplicasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer list all the replicas for a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ReplicasClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicasClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ReplicasClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ReplicasClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ReplicasClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ReplicasClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ReplicasClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/replicas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicasClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ReplicasClient) ListByServerResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serveradministrators.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serveradministrators.go deleted file mode 100644 index 56ca65f2c100..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serveradministrators.go +++ /dev/null @@ -1,391 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerAdministratorsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type ServerAdministratorsClient struct { - BaseClient -} - -// NewServerAdministratorsClient creates an instance of the ServerAdministratorsClient client. -func NewServerAdministratorsClient(subscriptionID string) ServerAdministratorsClient { - return NewServerAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerAdministratorsClientWithBaseURI creates an instance of the ServerAdministratorsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewServerAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAdministratorsClient { - return ServerAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or update active directory administrator on an existing server. The update action will -// overwrite the existing administrator. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// properties - the required parameters for creating or updating an AAD server administrator. -func (client ServerAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource) (result ServerAdministratorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: properties, - Constraints: []validation.Constraint{{Target: "properties.ServerAdministratorProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.ServerAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("mysql.ServerAdministratorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/administrators/activeDirectory", pathParameters), - autorest.WithJSON(properties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAdministratorsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAdministratorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes server active directory administrator. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerAdministratorsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/administrators/activeDirectory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) DeleteSender(req *http.Request) (future ServerAdministratorsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a AAD server administrator. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerAdministratorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/administrators/activeDirectory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) GetResponder(resp *http.Response) (result ServerAdministratorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of server Administrators. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerAdministratorsClient) List(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerAdministratorsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServerAdministratorsClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/administrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) ListResponder(resp *http.Response) (result ServerAdministratorResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverbasedperformancetier.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverbasedperformancetier.go deleted file mode 100644 index 0ff0eb048231..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverbasedperformancetier.go +++ /dev/null @@ -1,120 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type ServerBasedPerformanceTierClient struct { - BaseClient -} - -// NewServerBasedPerformanceTierClient creates an instance of the ServerBasedPerformanceTierClient client. -func NewServerBasedPerformanceTierClient(subscriptionID string) ServerBasedPerformanceTierClient { - return NewServerBasedPerformanceTierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerBasedPerformanceTierClientWithBaseURI creates an instance of the ServerBasedPerformanceTierClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewServerBasedPerformanceTierClientWithBaseURI(baseURI string, subscriptionID string) ServerBasedPerformanceTierClient { - return ServerBasedPerformanceTierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers for a MySQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerBasedPerformanceTierClient) List(ctx context.Context, resourceGroupName string, serverName string) (result PerformanceTierListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBasedPerformanceTierClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerBasedPerformanceTierClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerBasedPerformanceTierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerBasedPerformanceTierClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerBasedPerformanceTierClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServerBasedPerformanceTierClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/performanceTiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServerBasedPerformanceTierClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServerBasedPerformanceTierClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverkeys.go deleted file mode 100644 index 61c9f57c8326..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverkeys.go +++ /dev/null @@ -1,434 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerKeysClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type ServerKeysClient struct { - BaseClient -} - -// NewServerKeysClient creates an instance of the ServerKeysClient client. -func NewServerKeysClient(subscriptionID string) ServerKeysClient { - return NewServerKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerKeysClientWithBaseURI creates an instance of the ServerKeysClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServerKeysClientWithBaseURI(baseURI string, subscriptionID string) ServerKeysClient { - return ServerKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a MySQL Server key. -// Parameters: -// serverName - the name of the server. -// keyName - the name of the MySQL Server key to be operated on (updated or created). -// parameters - the requested MySQL Server key resource state. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServerKeysClient) CreateOrUpdate(ctx context.Context, serverName string, keyName string, parameters ServerKey, resourceGroupName string) (result ServerKeysCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerKeyProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerKeyProperties.ServerKeyType", Name: validation.Null, Rule: true, Chain: nil}}}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerKeysClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, serverName, keyName, parameters, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerKeysClient) CreateOrUpdatePreparer(ctx context.Context, serverName string, keyName string, parameters ServerKey, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) CreateOrUpdateSender(req *http.Request) (future ServerKeysCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ServerKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the MySQL Server key with the given name. -// Parameters: -// serverName - the name of the server. -// keyName - the name of the MySQL Server key to be deleted. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServerKeysClient) Delete(ctx context.Context, serverName string, keyName string, resourceGroupName string) (result ServerKeysDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerKeysClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, serverName, keyName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerKeysClient) DeletePreparer(ctx context.Context, serverName string, keyName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) DeleteSender(req *http.Request) (future ServerKeysDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a MySQL Server key. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// keyName - the name of the MySQL Server key to be retrieved. -func (client ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerKeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) GetResponder(resp *http.Response) (result ServerKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of Server keys. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerKeysClient) List(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.List") - defer func() { - sc := -1 - if result.sklr.Response.Response != nil { - sc = result.sklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerKeysClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "List", resp, "Failure sending request") - return - } - - result.sklr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "List", resp, "Failure responding to request") - return - } - if result.sklr.hasNextLink() && result.sklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServerKeysClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) ListResponder(resp *http.Response) (result ServerKeyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServerKeysClient) listNextResults(ctx context.Context, lastResults ServerKeyListResult) (result ServerKeyListResult, err error) { - req, err := lastResults.serverKeyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerKeysClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerKeysClient) ListComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serverName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverparameters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverparameters.go deleted file mode 100644 index 23cefc81919a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serverparameters.go +++ /dev/null @@ -1,126 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerParametersClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type ServerParametersClient struct { - BaseClient -} - -// NewServerParametersClient creates an instance of the ServerParametersClient client. -func NewServerParametersClient(subscriptionID string) ServerParametersClient { - return NewServerParametersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerParametersClientWithBaseURI creates an instance of the ServerParametersClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewServerParametersClientWithBaseURI(baseURI string, subscriptionID string) ServerParametersClient { - return ServerParametersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListUpdateConfigurations update a list of configurations in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// value - the parameters for updating a list of server configuration. -func (client ServerParametersClient) ListUpdateConfigurations(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult) (result ServerParametersListUpdateConfigurationsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerParametersClient.ListUpdateConfigurations") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerParametersClient", "ListUpdateConfigurations", err.Error()) - } - - req, err := client.ListUpdateConfigurationsPreparer(ctx, resourceGroupName, serverName, value) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerParametersClient", "ListUpdateConfigurations", nil, "Failure preparing request") - return - } - - result, err = client.ListUpdateConfigurationsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerParametersClient", "ListUpdateConfigurations", result.Response(), "Failure sending request") - return - } - - return -} - -// ListUpdateConfigurationsPreparer prepares the ListUpdateConfigurations request. -func (client ServerParametersClient) ListUpdateConfigurationsPreparer(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/updateConfigurations", pathParameters), - autorest.WithJSON(value), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUpdateConfigurationsSender sends the ListUpdateConfigurations request. The method will close the -// http.Response Body if it receives an error. -func (client ServerParametersClient) ListUpdateConfigurationsSender(req *http.Request) (future ServerParametersListUpdateConfigurationsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ListUpdateConfigurationsResponder handles the response to the ListUpdateConfigurations request. The method always -// closes the http.Response Body. -func (client ServerParametersClient) ListUpdateConfigurationsResponder(resp *http.Response) (result ConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/servers.go deleted file mode 100644 index 941fcd3e9b65..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/servers.go +++ /dev/null @@ -1,907 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServersClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type ServersClient struct { - BaseClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new server or updates an existing server. The update action will overwrite the existing server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for creating or updating a server. -func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (result ServersCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the servers in a given subscription. -func (client ServersClient) List(ctx context.Context) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the servers in a given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restart restarts a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Restart(ctx context.Context, resourceGroupName string, serverName string) (result ServersRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Restart", err.Error()) - } - - req, err := client.RestartPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client ServersClient) RestartPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) RestartSender(req *http.Request) (future ServersRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client ServersClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start starts a stopped server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Start(ctx context.Context, resourceGroupName string, serverName string) (result ServersStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ServersClient) StartPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) StartSender(req *http.Request) (future ServersStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ServersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops a running server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Stop(ctx context.Context, resourceGroupName string, serverName string) (result ServersStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ServersClient) StopPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) StopSender(req *http.Request) (future ServersStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ServersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing server. The request body can contain one to many of the properties present in the normal -// server definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for updating a server. -func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (result ServersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Upgrade upgrade server version. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for updating a server. -func (client ServersClient) Upgrade(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpgradeParameters) (result ServersUpgradeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Upgrade") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServersClient", "Upgrade", err.Error()) - } - - req, err := client.UpgradePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Upgrade", nil, "Failure preparing request") - return - } - - result, err = client.UpgradeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServersClient", "Upgrade", result.Response(), "Failure sending request") - return - } - - return -} - -// UpgradePreparer prepares the Upgrade request. -func (client ServersClient) UpgradePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpgradeParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/upgrade", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpgradeSender sends the Upgrade request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) UpgradeSender(req *http.Request) (future ServersUpgradeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpgradeResponder handles the response to the Upgrade request. The method always -// closes the http.Response Body. -func (client ServersClient) UpgradeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serversecurityalertpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serversecurityalertpolicies.go deleted file mode 100644 index 44a8396b8078..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/serversecurityalertpolicies.go +++ /dev/null @@ -1,340 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerSecurityAlertPoliciesClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files -// and configurations with new business model. -type ServerSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewServerSecurityAlertPoliciesClient creates an instance of the ServerSecurityAlertPoliciesClient client. -func NewServerSecurityAlertPoliciesClient(subscriptionID string) ServerSecurityAlertPoliciesClient { - return NewServerSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerSecurityAlertPoliciesClientWithBaseURI creates an instance of the ServerSecurityAlertPoliciesClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewServerSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerSecurityAlertPoliciesClient { - return ServerSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the server security alert policy. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (result ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a server's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerSecurityAlertPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer get the server's threat detection policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.ssaplr.Response.Response != nil { - sc = result.ssaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.ServerSecurityAlertPoliciesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.ssaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.ssaplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.ssaplr.hasNextLink() && result.ssaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerSecurityAlertPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) ListByServerResponder(resp *http.Response) (result ServerSecurityAlertPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerSecurityAlertPoliciesClient) listByServerNextResults(ctx context.Context, lastResults ServerSecurityAlertPolicyListResult) (result ServerSecurityAlertPolicyListResult, err error) { - req, err := lastResults.serverSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerSecurityAlertPoliciesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/topquerystatistics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/topquerystatistics.go deleted file mode 100644 index 3a4006893827..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/topquerystatistics.go +++ /dev/null @@ -1,261 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TopQueryStatisticsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type TopQueryStatisticsClient struct { - BaseClient -} - -// NewTopQueryStatisticsClient creates an instance of the TopQueryStatisticsClient client. -func NewTopQueryStatisticsClient(subscriptionID string) TopQueryStatisticsClient { - return NewTopQueryStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopQueryStatisticsClientWithBaseURI creates an instance of the TopQueryStatisticsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewTopQueryStatisticsClientWithBaseURI(baseURI string, subscriptionID string) TopQueryStatisticsClient { - return TopQueryStatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the query statistic for specified identifier. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// queryStatisticID - the Query Statistic identifier. -func (client TopQueryStatisticsClient) Get(ctx context.Context, resourceGroupName string, serverName string, queryStatisticID string) (result QueryStatistic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.TopQueryStatisticsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, queryStatisticID) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopQueryStatisticsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, queryStatisticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "queryStatisticId": autorest.Encode("path", queryStatisticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/topQueryStatistics/{queryStatisticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TopQueryStatisticsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TopQueryStatisticsClient) GetResponder(resp *http.Response) (result QueryStatistic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve the Query-Store top queries for specified metric and aggregation. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for retrieving top query statistics. -func (client TopQueryStatisticsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, parameters TopQueryStatisticsInput) (result TopQueryStatisticsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.tqsrl.Response.Response != nil { - sc = result.tqsrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TopQueryStatisticsInputProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TopQueryStatisticsInputProperties.NumberOfTopQueries", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.AggregationFunction", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.ObservedMetric", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.ObservationStartTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.ObservationEndTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.AggregationWindow", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("mysql.TopQueryStatisticsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.tqsrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.tqsrl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.tqsrl.hasNextLink() && result.tqsrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client TopQueryStatisticsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters TopQueryStatisticsInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/topQueryStatistics", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client TopQueryStatisticsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client TopQueryStatisticsClient) ListByServerResponder(resp *http.Response) (result TopQueryStatisticsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client TopQueryStatisticsClient) listByServerNextResults(ctx context.Context, lastResults TopQueryStatisticsResultList) (result TopQueryStatisticsResultList, err error) { - req, err := lastResults.topQueryStatisticsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.TopQueryStatisticsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopQueryStatisticsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, parameters TopQueryStatisticsInput) (result TopQueryStatisticsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, parameters) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/version.go deleted file mode 100644 index d12b8fbbc0f9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package mysql - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " mysql/2020-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/virtualnetworkrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/virtualnetworkrules.go deleted file mode 100644 index ad04dedfe9c4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/virtualnetworkrules.go +++ /dev/null @@ -1,434 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualNetworkRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type VirtualNetworkRulesClient struct { - BaseClient -} - -// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. -func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { - return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { - return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an existing virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -// parameters - the requested virtual Network Rule Resource state. -func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("mysql.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the virtual network rule with the given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.VirtualNetworkRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.VirtualNetworkRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of virtual network rules in a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.vnrlr.Response.Response != nil { - sc = result.vnrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.VirtualNetworkRulesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.vnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.vnrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.vnrlr.hasNextLink() && result.vnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client VirtualNetworkRulesClient) listByServerNextResults(ctx context.Context, lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { - req, err := lastResults.virtualNetworkRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/waitstatistics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/waitstatistics.go deleted file mode 100644 index 741f248a92e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql/waitstatistics.go +++ /dev/null @@ -1,257 +0,0 @@ -package mysql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WaitStatisticsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type WaitStatisticsClient struct { - BaseClient -} - -// NewWaitStatisticsClient creates an instance of the WaitStatisticsClient client. -func NewWaitStatisticsClient(subscriptionID string) WaitStatisticsClient { - return NewWaitStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWaitStatisticsClientWithBaseURI creates an instance of the WaitStatisticsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWaitStatisticsClientWithBaseURI(baseURI string, subscriptionID string) WaitStatisticsClient { - return WaitStatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve wait statistics for specified identifier. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// waitStatisticsID - the Wait Statistic identifier. -func (client WaitStatisticsClient) Get(ctx context.Context, resourceGroupName string, serverName string, waitStatisticsID string) (result WaitStatistic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mysql.WaitStatisticsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, waitStatisticsID) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WaitStatisticsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, waitStatisticsID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "waitStatisticsId": autorest.Encode("path", waitStatisticsID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/waitStatistics/{waitStatisticsId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WaitStatisticsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WaitStatisticsClient) GetResponder(resp *http.Response) (result WaitStatistic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve wait statistics for specified aggregation window. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for retrieving wait statistics. -func (client WaitStatisticsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, parameters WaitStatisticsInput) (result WaitStatisticsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.wsrl.Response.Response != nil { - sc = result.wsrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WaitStatisticsInputProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.WaitStatisticsInputProperties.ObservationStartTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WaitStatisticsInputProperties.ObservationEndTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WaitStatisticsInputProperties.AggregationWindow", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("mysql.WaitStatisticsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.wsrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.wsrl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.wsrl.hasNextLink() && result.wsrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client WaitStatisticsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters WaitStatisticsInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/waitStatistics", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client WaitStatisticsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client WaitStatisticsClient) ListByServerResponder(resp *http.Response) (result WaitStatisticsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client WaitStatisticsClient) listByServerNextResults(ctx context.Context, lastResults WaitStatisticsResultList) (result WaitStatisticsResultList, err error) { - req, err := lastResults.waitStatisticsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mysql.WaitStatisticsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client WaitStatisticsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, parameters WaitStatisticsInput) (result WaitStatisticsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, parameters) - return -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 703d6568f5be..c80c23f4a4cf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -8,7 +8,6 @@ github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01/hdinsight -github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql github.com/Azure/azure-sdk-for-go/services/preview/alertsmanagement/mgmt/2019-06-01-preview/alertsmanagement github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation From 98b4ce8880bf8e60c5788609dd128b2d6eb30ad8 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 2 Aug 2023 18:22:37 -0700 Subject: [PATCH 09/12] go mod tidy and lint --- internal/services/mysql/mysql_server_data_source.go | 12 ++++++++++-- internal/services/mysql/mysql_server_key_resource.go | 2 +- internal/services/mysql/mysql_server_resource.go | 12 ++++++++++-- .../mysql/mysql_virtual_network_rule_resource.go | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/internal/services/mysql/mysql_server_data_source.go b/internal/services/mysql/mysql_server_data_source.go index cc5a2fad2695..11611a47098e 100644 --- a/internal/services/mysql/mysql_server_data_source.go +++ b/internal/services/mysql/mysql_server_data_source.go @@ -202,8 +202,16 @@ func dataSourceMySqlServerRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("infrastructure_encryption_enabled", pointer.From(props.InfrastructureEncryption) == servers.InfrastructureEncryptionEnabled) d.Set("public_network_access_enabled", pointer.From(props.PublicNetworkAccess) == servers.PublicNetworkAccessEnumEnabled) d.Set("ssl_enforcement_enabled", pointer.From(props.SslEnforcement) == servers.SslEnforcementEnumEnabled) - d.Set("ssl_minimal_tls_version_enforced", props.MinimalTlsVersion) - d.Set("version", props.Version) + minimalTlsVersion := "" + if props.MinimalTlsVersion != nil { + minimalTlsVersion = string(*props.MinimalTlsVersion) + } + d.Set("ssl_minimal_tls_version_enforced", minimalTlsVersion) + version := "" + if props.Version != nil { + version = string(*props.Version) + } + d.Set("version", version) if storage := props.StorageProfile; storage != nil { d.Set("auto_grow_enabled", pointer.From(storage.StorageAutogrow) == servers.StorageAutogrowEnabled) diff --git a/internal/services/mysql/mysql_server_key_resource.go b/internal/services/mysql/mysql_server_key_resource.go index 55a84c8cfd12..25cadf3b8096 100644 --- a/internal/services/mysql/mysql_server_key_resource.go +++ b/internal/services/mysql/mysql_server_key_resource.go @@ -98,7 +98,7 @@ func resourceMySQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta interfac // Therefore sometimes you cannot get the old key using the GET API since you may not know the name of the old key resp, err := keysClient.List(ctx, *serverID) if err != nil { - return fmt.Errorf("listing existing MySQL Server Keys in %s", serverID, err) + return fmt.Errorf("listing existing MySQL Server Keys in %s: %s", serverID, err) } if resp.Model == nil { return fmt.Errorf("model was nil for %s", serverID) diff --git a/internal/services/mysql/mysql_server_resource.go b/internal/services/mysql/mysql_server_resource.go index c14ed4bc7ac9..b81145396184 100644 --- a/internal/services/mysql/mysql_server_resource.go +++ b/internal/services/mysql/mysql_server_resource.go @@ -609,8 +609,16 @@ func resourceMySqlServerRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("infrastructure_encryption_enabled", pointer.From(props.InfrastructureEncryption) == servers.InfrastructureEncryptionEnabled) d.Set("public_network_access_enabled", pointer.From(props.PublicNetworkAccess) == servers.PublicNetworkAccessEnumEnabled) d.Set("ssl_enforcement_enabled", pointer.From(props.SslEnforcement) == servers.SslEnforcementEnumEnabled) - d.Set("ssl_minimal_tls_version_enforced", props.MinimalTlsVersion) - d.Set("version", props.Version) + minimalTlsVersion := "" + if props.MinimalTlsVersion != nil { + minimalTlsVersion = string(*props.MinimalTlsVersion) + } + d.Set("ssl_minimal_tls_version_enforced", minimalTlsVersion) + version := "" + if props.Version != nil { + version = string(*props.Version) + } + d.Set("version", version) if storage := props.StorageProfile; storage != nil { d.Set("auto_grow_enabled", pointer.From(storage.StorageAutogrow) == servers.StorageAutogrowEnabled) diff --git a/internal/services/mysql/mysql_virtual_network_rule_resource.go b/internal/services/mysql/mysql_virtual_network_rule_resource.go index 8d8b4c4c9353..050849dfae44 100644 --- a/internal/services/mysql/mysql_virtual_network_rule_resource.go +++ b/internal/services/mysql/mysql_virtual_network_rule_resource.go @@ -187,8 +187,8 @@ func mySQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client * if model := resp.Model; model != nil { if props := model.Properties; props != nil { - log.Printf("[DEBUG] Retrieving %s returned Status %s", id, props.State) if props.State != nil { + log.Printf("[DEBUG] Retrieving %s returned Status %s", id, *props.State) return resp, string(*props.State), nil } } From ec749db10cf083824d8a9d4ca3e3b56b48713ee6 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 3 Aug 2023 13:44:39 +0200 Subject: [PATCH 10/12] r/mysql_server: fixing the validation (TLS 1.1 and not 1.2, twice) --- internal/services/mysql/mysql_server_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mysql/mysql_server_resource.go b/internal/services/mysql/mysql_server_resource.go index b81145396184..c40494cc942c 100644 --- a/internal/services/mysql/mysql_server_resource.go +++ b/internal/services/mysql/mysql_server_resource.go @@ -185,7 +185,7 @@ func resourceMySqlServer() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(servers.MinimalTlsVersionEnumTLSEnforcementDisabled), string(servers.MinimalTlsVersionEnumTLSOneZero), - string(servers.MinimalTlsVersionEnumTLSOneTwo), + string(servers.MinimalTlsVersionEnumTLSOneOne), string(servers.MinimalTlsVersionEnumTLSOneTwo), }, false), }, From 7033c0c9024c7b4f6d98f1ea4667dee20e985c37 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 3 Aug 2023 13:44:54 +0200 Subject: [PATCH 11/12] r/mysql_configuration: adding a timeout to the query context --- .../services/mysql/mysql_configuration_resource_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/services/mysql/mysql_configuration_resource_test.go b/internal/services/mysql/mysql_configuration_resource_test.go index 8ad9457b8e8a..610cb66b66b5 100644 --- a/internal/services/mysql/mysql_configuration_resource_test.go +++ b/internal/services/mysql/mysql_configuration_resource_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "testing" + "time" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/configurations" @@ -107,7 +108,9 @@ func (r MySQLConfigurationResource) checkReset(configurationName string) accepta configurationId := configurations.NewConfigurationID(serverId.SubscriptionId, serverId.ResourceGroupName, serverId.ServerName, configurationName) - resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx, configurationId) + ctx2, cancel := context.WithTimeout(ctx, 15*time.Minute) + defer cancel() + resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx2, configurationId) if err != nil { if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s does not exist", configurationId) @@ -136,7 +139,9 @@ func (r MySQLConfigurationResource) checkValue(value string) acceptance.ClientCh return err } - resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx, *id) + ctx2, cancel := context.WithTimeout(ctx, 15*time.Minute) + defer cancel() + resp, err := clients.MySQL.MySqlClient.Configurations.Get(ctx2, *id) if err != nil { if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s does not exist", id) From 3dd39369ef591b0afd584a3390571a3f8ece29dc Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 3 Aug 2023 14:16:50 +0200 Subject: [PATCH 12/12] r/mysql_configuration: using the default value in the delete --- internal/services/mysql/mysql_configuration_resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/mysql/mysql_configuration_resource.go b/internal/services/mysql/mysql_configuration_resource.go index 352e00cc860d..0b5857c9e927 100644 --- a/internal/services/mysql/mysql_configuration_resource.go +++ b/internal/services/mysql/mysql_configuration_resource.go @@ -138,8 +138,8 @@ func resourceMySQLConfigurationDelete(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving %s: %+v", id, err) } defaultValue := "" - if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.Value != nil { - defaultValue = *resp.Model.Properties.Value + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.DefaultValue != nil { + defaultValue = *resp.Model.Properties.DefaultValue } properties := configurations.Configuration{