From a2aa0a62c70015e12bb27548be50ea1df9b198cd Mon Sep 17 00:00:00 2001 From: hc-github-team-tf-azure <> Date: Tue, 15 Oct 2024 06:26:45 +0000 Subject: [PATCH] Updating based on 388b94dfd --- .../2024-05-01-preview/appplatform/README.md | 2871 ++++++++++++++++ .../2024-05-01-preview/appplatform/client.go | 26 + .../appplatform/constants.go | 2882 +++++++++++++++++ .../appplatform/id_agentpool.go | 148 + .../appplatform/id_agentpool_test.go | 372 +++ .../appplatform/id_apiportal.go | 139 + .../appplatform/id_apiportal_test.go | 327 ++ .../appplatform/id_apiportaldomain.go | 148 + .../appplatform/id_apiportaldomain_test.go | 372 +++ .../2024-05-01-preview/appplatform/id_apm.go | 139 + .../appplatform/id_apm_test.go | 327 ++ .../2024-05-01-preview/appplatform/id_app.go | 139 + .../appplatform/id_app_test.go | 327 ++ .../appplatform/id_applicationaccelerator.go | 139 + .../id_applicationaccelerator_test.go | 327 ++ .../appplatform/id_applicationliveview.go | 139 + .../id_applicationliveview_test.go | 327 ++ .../appplatform/id_binding.go | 148 + .../appplatform/id_binding_test.go | 372 +++ .../appplatform/id_build.go | 148 + .../appplatform/id_build_test.go | 372 +++ .../appplatform/id_builder.go | 148 + .../appplatform/id_builder_test.go | 372 +++ .../appplatform/id_buildpackbinding.go | 157 + .../appplatform/id_buildpackbinding_test.go | 417 +++ .../appplatform/id_buildservice.go | 139 + .../appplatform/id_buildservice_test.go | 327 ++ .../appplatform/id_certificate.go | 139 + .../appplatform/id_certificate_test.go | 327 ++ .../appplatform/id_configurationservice.go | 139 + .../id_configurationservice_test.go | 327 ++ .../appplatform/id_containerregistry.go | 139 + .../appplatform/id_containerregistry_test.go | 327 ++ .../appplatform/id_customizedaccelerator.go | 148 + .../id_customizedaccelerator_test.go | 372 +++ .../appplatform/id_deployment.go | 148 + .../appplatform/id_deployment_test.go | 372 +++ .../appplatform/id_devtoolportal.go | 139 + .../appplatform/id_devtoolportal_test.go | 327 ++ .../appplatform/id_domain.go | 148 + .../appplatform/id_domain_test.go | 372 +++ .../appplatform/id_execution.go | 148 + .../appplatform/id_execution_test.go | 372 +++ .../appplatform/id_gateway.go | 139 + .../appplatform/id_gateway_test.go | 327 ++ .../appplatform/id_gatewaydomain.go | 148 + .../appplatform/id_gatewaydomain_test.go | 372 +++ .../2024-05-01-preview/appplatform/id_job.go | 139 + .../appplatform/id_job_test.go | 327 ++ .../appplatform/id_location.go | 121 + .../appplatform/id_location_test.go | 237 ++ .../appplatform/id_predefinedaccelerator.go | 148 + .../id_predefinedaccelerator_test.go | 372 +++ .../appplatform/id_result.go | 157 + .../appplatform/id_result_test.go | 417 +++ .../appplatform/id_routeconfig.go | 148 + .../appplatform/id_routeconfig_test.go | 372 +++ .../appplatform/id_serviceregistry.go | 139 + .../appplatform/id_serviceregistry_test.go | 327 ++ .../appplatform/id_storage.go | 139 + .../appplatform/id_storage_test.go | 327 ++ .../appplatform/id_supportedbuildpack.go | 148 + .../appplatform/id_supportedbuildpack_test.go | 372 +++ .../appplatform/id_supportedstack.go | 148 + .../appplatform/id_supportedstack_test.go | 372 +++ ...od_apiportalcustomdomainscreateorupdate.go | 75 + .../method_apiportalcustomdomainsdelete.go | 71 + .../method_apiportalcustomdomainsget.go | 53 + .../method_apiportalcustomdomainslist.go | 105 + .../method_apiportalscreateorupdate.go | 75 + .../appplatform/method_apiportalsdelete.go | 71 + .../appplatform/method_apiportalsget.go | 53 + .../appplatform/method_apiportalslist.go | 106 + .../method_apiportalsvalidatedomain.go | 58 + .../appplatform/method_apmscreateorupdate.go | 75 + .../appplatform/method_apmsdelete.go | 70 + .../appplatform/method_apmsget.go | 53 + .../appplatform/method_apmslist.go | 106 + .../appplatform/method_apmslistsecretkeys.go | 54 + ...d_applicationacceleratorscreateorupdate.go | 75 + .../method_applicationacceleratorsdelete.go | 70 + .../method_applicationacceleratorsget.go | 53 + .../method_applicationacceleratorslist.go | 106 + ...thod_applicationliveviewscreateorupdate.go | 75 + .../method_applicationliveviewsdelete.go | 70 + .../method_applicationliveviewsget.go | 53 + .../method_applicationliveviewslist.go | 106 + .../appplatform/method_appscreateorupdate.go | 76 + .../appplatform/method_appsdelete.go | 71 + .../appplatform/method_appsget.go | 83 + .../method_appsgetresourceuploadurl.go | 54 + .../appplatform/method_appslist.go | 106 + .../method_appssetactivedeployments.go | 75 + .../appplatform/method_appsupdate.go | 75 + .../appplatform/method_appsvalidatedomain.go | 58 + .../method_bindingscreateorupdate.go | 76 + .../appplatform/method_bindingsdelete.go | 71 + .../appplatform/method_bindingsget.go | 53 + .../appplatform/method_bindingslist.go | 105 + .../appplatform/method_bindingsupdate.go | 75 + .../method_buildpackbindingcreateorupdate.go | 75 + .../method_buildpackbindingdelete.go | 71 + .../appplatform/method_buildpackbindingget.go | 53 + .../method_buildpackbindinglist.go | 105 + .../method_buildpackbindinglistforcluster.go | 106 + .../method_buildserviceagentpoolget.go | 53 + .../method_buildserviceagentpoollist.go | 105 + .../method_buildserviceagentpoolupdateput.go | 75 + ...ethod_buildservicebuildercreateorupdate.go | 75 + .../method_buildservicebuilderdelete.go | 71 + .../method_buildservicebuilderget.go | 53 + .../method_buildservicebuilderlist.go | 105 + ...thod_buildservicebuilderlistdeployments.go | 54 + .../method_buildservicecreateorupdate.go | 75 + .../method_buildservicecreateorupdatebuild.go | 58 + .../method_buildservicedeletebuild.go | 70 + .../method_buildservicegetbuild.go | 53 + .../method_buildservicegetbuildresult.go | 53 + .../method_buildservicegetbuildresultlog.go | 54 + .../method_buildservicegetbuildservice.go | 53 + ...method_buildservicegetresourceuploadurl.go | 54 + ...ethod_buildservicegetsupportedbuildpack.go | 53 + .../method_buildservicegetsupportedstack.go | 53 + .../method_buildservicelistbuildresults.go | 105 + .../method_buildservicelistbuilds.go | 105 + .../method_buildservicelistbuildservices.go | 106 + ...hod_buildservicelistsupportedbuildpacks.go | 105 + .../method_buildservicelistsupportedstacks.go | 105 + .../method_certificatescreateorupdate.go | 76 + .../appplatform/method_certificatesdelete.go | 71 + .../appplatform/method_certificatesget.go | 53 + .../appplatform/method_certificateslist.go | 106 + .../appplatform/method_configserversdelete.go | 71 + .../appplatform/method_configserversget.go | 55 + .../appplatform/method_configserverslist.go | 106 + .../method_configserversupdatepatch.go | 76 + .../method_configserversupdateput.go | 76 + .../method_configserversvalidate.go | 76 + ...hod_configurationservicescreateorupdate.go | 75 + .../method_configurationservicesdelete.go | 71 + .../method_configurationservicesget.go | 53 + .../method_configurationserviceslist.go | 106 + .../method_configurationservicesvalidate.go | 75 + ...d_configurationservicesvalidateresource.go | 75 + ...ethod_containerregistriescreateorupdate.go | 75 + .../method_containerregistriesdelete.go | 70 + .../method_containerregistriesget.go | 53 + .../method_containerregistrieslist.go | 106 + .../method_containerregistriesvalidate.go | 75 + .../method_customdomainscreateorupdate.go | 76 + .../appplatform/method_customdomainsdelete.go | 71 + .../appplatform/method_customdomainsget.go | 53 + .../appplatform/method_customdomainslist.go | 105 + .../appplatform/method_customdomainsupdate.go | 75 + ...od_customizedacceleratorscreateorupdate.go | 75 + .../method_customizedacceleratorsdelete.go | 70 + .../method_customizedacceleratorsget.go | 53 + .../method_customizedacceleratorslist.go | 105 + .../method_customizedacceleratorsvalidate.go | 75 + .../method_deploymentscreateorupdate.go | 76 + .../appplatform/method_deploymentsdelete.go | 71 + ...ethod_deploymentsdisableremotedebugging.go | 71 + ...method_deploymentsenableremotedebugging.go | 75 + .../method_deploymentsgenerateheapdump.go | 74 + .../method_deploymentsgeneratethreaddump.go | 74 + .../appplatform/method_deploymentsget.go | 53 + .../method_deploymentsgetlogfileurl.go | 55 + ...hod_deploymentsgetremotedebuggingconfig.go | 54 + .../appplatform/method_deploymentslist.go | 138 + .../method_deploymentslistforcluster.go | 139 + .../appplatform/method_deploymentsrestart.go | 70 + .../appplatform/method_deploymentsstart.go | 70 + .../appplatform/method_deploymentsstartjfr.go | 74 + .../appplatform/method_deploymentsstop.go | 70 + .../appplatform/method_deploymentsupdate.go | 75 + .../method_devtoolportalscreateorupdate.go | 75 + .../method_devtoolportalsdelete.go | 70 + .../appplatform/method_devtoolportalsget.go | 53 + .../appplatform/method_devtoolportalslist.go | 106 + .../appplatform/method_eurekaserversget.go | 55 + .../appplatform/method_eurekaserverslist.go | 106 + .../method_eurekaserversupdatepatch.go | 76 + .../method_eurekaserversupdateput.go | 76 + ...thod_gatewaycustomdomainscreateorupdate.go | 75 + .../method_gatewaycustomdomainsdelete.go | 71 + .../method_gatewaycustomdomainsget.go | 53 + .../method_gatewaycustomdomainslist.go | 105 + ...ethod_gatewayrouteconfigscreateorupdate.go | 75 + .../method_gatewayrouteconfigsdelete.go | 71 + .../method_gatewayrouteconfigsget.go | 53 + .../method_gatewayrouteconfigslist.go | 105 + .../method_gatewayscreateorupdate.go | 75 + .../appplatform/method_gatewaysdelete.go | 71 + .../appplatform/method_gatewaysget.go | 53 + .../appplatform/method_gatewayslist.go | 106 + .../method_gatewayslistenvsecrets.go | 54 + .../appplatform/method_gatewaysrestart.go | 70 + .../method_gatewaysupdatecapacity.go | 75 + .../method_gatewaysvalidatedomain.go | 58 + .../appplatform/method_jobcreateorupdate.go | 75 + .../appplatform/method_jobdelete.go | 70 + .../appplatform/method_jobexecutioncancel.go | 69 + .../appplatform/method_jobexecutionget.go | 53 + .../method_jobexecutionlistenvsecrets.go | 54 + .../appplatform/method_jobexecutionslist.go | 105 + .../appplatform/method_jobget.go | 53 + .../appplatform/method_joblistenvsecrets.go | 54 + .../appplatform/method_jobslist.go | 106 + .../appplatform/method_jobstart.go | 75 + .../method_monitoringsettingsget.go | 55 + .../method_monitoringsettingsupdatepatch.go | 76 + .../method_monitoringsettingsupdateput.go | 76 + .../method_predefinedacceleratorsdisable.go | 70 + .../method_predefinedacceleratorsenable.go | 70 + .../method_predefinedacceleratorsget.go | 53 + .../method_predefinedacceleratorslist.go | 105 + ...thod_runtimeversionslistruntimeversions.go | 53 + .../method_serviceregistriescreateorupdate.go | 71 + .../method_serviceregistriesdelete.go | 71 + .../method_serviceregistriesget.go | 53 + .../method_serviceregistrieslist.go | 106 + .../method_serviceschecknameavailability.go | 58 + .../method_servicescreateorupdate.go | 77 + .../appplatform/method_servicesdelete.go | 72 + .../method_servicesdisableapmglobally.go | 75 + .../method_servicesdisabletestendpoint.go | 48 + .../method_servicesenableapmglobally.go | 75 + .../method_servicesenabletestendpoint.go | 55 + .../method_servicesflushvnetdnssetting.go | 70 + .../appplatform/method_servicesget.go | 54 + .../appplatform/method_serviceslist.go | 106 + .../method_serviceslistbysubscription.go | 106 + .../method_serviceslistgloballyenabledapms.go | 55 + .../method_serviceslistsupportedapmtypes.go | 106 + ...hod_serviceslistsupportedserverversions.go | 106 + .../method_serviceslisttestkeys.go | 55 + .../method_servicesregeneratetestkey.go | 59 + .../appplatform/method_servicesstart.go | 70 + .../appplatform/method_servicesstop.go | 70 + .../appplatform/method_servicesupdate.go | 76 + .../appplatform/method_skuslist.go | 106 + .../method_storagescreateorupdate.go | 76 + .../appplatform/method_storagesdelete.go | 71 + .../appplatform/method_storagesget.go | 53 + .../appplatform/method_storageslist.go | 106 + .../model_acceleratorauthsetting.go | 91 + .../model_acceleratorbasicauthsetting.go | 52 + .../model_acceleratorgitrepository.go | 57 + .../model_acceleratorpublicsetting.go | 50 + .../model_acceleratorsshsetting.go | 52 + .../model_activedeploymentcollection.go | 8 + .../model_apiportalcustomdomainproperties.go | 8 + .../model_apiportalcustomdomainresource.go | 16 + .../appplatform/model_apiportalinstance.go | 9 + .../appplatform/model_apiportalproperties.go | 17 + .../appplatform/model_apiportalresource.go | 17 + .../model_apiportalresourcerequests.go | 9 + .../appplatform/model_apmproperties.go | 11 + .../appplatform/model_apmreference.go | 8 + .../appplatform/model_apmresource.go | 16 + .../appplatform/model_apmsecretkeys.go | 8 + .../model_applicationacceleratorcomponent.go | 10 + .../model_applicationacceleratorinstance.go | 9 + .../model_applicationacceleratorproperties.go | 9 + .../model_applicationacceleratorresource.go | 17 + ..._applicationacceleratorresourcerequests.go | 10 + .../model_applicationinsightsagentversions.go | 8 + .../model_applicationliveviewcomponent.go | 10 + .../model_applicationliveviewinstance.go | 9 + .../model_applicationliveviewproperties.go | 9 + .../model_applicationliveviewresource.go | 16 + ...del_applicationliveviewresourcerequests.go | 10 + .../appplatform/model_appresource.go | 19 + .../model_appresourceproperties.go | 23 + .../appplatform/model_appvnetaddons.go | 9 + .../model_availableruntimeversions.go | 8 + .../appplatform/model_azurefilevolume.go | 58 + .../appplatform/model_bindingresource.go | 16 + .../model_bindingresourceproperties.go | 15 + .../appplatform/model_build.go | 16 + .../appplatform/model_builderproperties.go | 10 + .../appplatform/model_builderresource.go | 16 + .../model_buildpackbindinglaunchproperties.go | 9 + .../model_buildpackbindingproperties.go | 10 + .../model_buildpackbindingresource.go | 16 + .../appplatform/model_buildpackproperties.go | 9 + .../model_buildpacksgroupproperties.go | 9 + .../appplatform/model_buildproperties.go | 16 + .../model_buildresourcerequests.go | 9 + .../appplatform/model_buildresult.go | 16 + .../appplatform/model_buildresultlog.go | 8 + .../model_buildresultproperties.go | 13 + .../model_buildresultusersourceinfo.go | 52 + .../appplatform/model_buildservice.go | 16 + .../model_buildserviceagentpoolproperties.go | 9 + .../model_buildserviceagentpoolresource.go | 16 + ...del_buildserviceagentpoolsizeproperties.go | 10 + .../model_buildserviceproperties.go | 11 + ..._buildservicepropertiesresourcerequests.go | 9 + .../appplatform/model_buildstageproperties.go | 11 + .../model_certificateproperties.go | 91 + .../appplatform/model_certificatereference.go | 8 + .../appplatform/model_certificateresource.go | 53 + .../model_clusterresourceproperties.go | 72 + .../model_configservergitproperty.go | 17 + .../appplatform/model_configserverinstance.go | 9 + .../model_configserverproperties.go | 13 + .../appplatform/model_configserverresource.go | 16 + .../model_configserverresourcerequests.go | 10 + .../appplatform/model_configserversettings.go | 8 + .../model_configserversettingserrorrecord.go | 10 + ...odel_configserversettingsvalidateresult.go | 9 + .../model_configurationservicegitproperty.go | 8 + ...urationservicegitpropertyvalidateresult.go | 9 + ...model_configurationservicegitrepository.go | 20 + .../model_configurationserviceinstance.go | 9 + .../model_configurationserviceproperties.go | 12 + .../model_configurationserviceresource.go | 16 + ...el_configurationserviceresourcerequests.go | 10 + .../model_configurationservicesettings.go | 9 + ...figurationservicesettingsvalidateresult.go | 8 + .../model_containerprobesettings.go | 8 + ...model_containerregistrybasiccredentials.go | 52 + .../model_containerregistrycredentials.go | 75 + .../model_containerregistryproperties.go | 42 + .../model_containerregistryresource.go | 16 + .../model_containerregistryvalidateresult.go | 9 + .../model_contentcertificateproperties.go | 66 + .../appplatform/model_customcontainer.go | 13 + .../model_customcontainerusersourceinfo.go | 52 + .../model_customdomainproperties.go | 11 + .../appplatform/model_customdomainresource.go | 16 + .../model_customdomainvalidatepayload.go | 8 + .../model_customdomainvalidateresult.go | 9 + .../model_customizedacceleratorproperties.go | 15 + .../model_customizedacceleratorresource.go | 17 + ...del_customizedacceleratorvalidateresult.go | 9 + .../model_custompersistentdiskproperties.go | 79 + .../model_custompersistentdiskresource.go | 42 + .../appplatform/model_customscalerule.go | 10 + .../appplatform/model_deploymentinstance.go | 13 + .../appplatform/model_deploymentlist.go | 8 + .../appplatform/model_deploymentresource.go | 17 + .../model_deploymentresourceproperties.go | 54 + .../appplatform/model_deploymentsettings.go | 17 + .../model_devtoolportalcomponent.go | 10 + .../model_devtoolportalfeaturedetail.go | 9 + .../model_devtoolportalfeaturesettings.go | 9 + .../model_devtoolportalinstance.go | 9 + .../model_devtoolportalproperties.go | 13 + .../model_devtoolportalresource.go | 16 + .../model_devtoolportalresourcerequests.go | 10 + .../model_devtoolportalssoproperties.go | 11 + .../appplatform/model_diagnosticparameters.go | 10 + .../appplatform/model_envsecretscollection.go | 8 + .../appplatform/model_envvar.go | 10 + .../appplatform/model_error.go | 9 + .../model_eurekaserverproperties.go | 10 + .../appplatform/model_eurekaserverresource.go | 16 + .../appplatform/model_execaction.go | 50 + .../model_gatewayapimetadataproperties.go | 12 + .../appplatform/model_gatewayapiroute.go | 16 + .../model_gatewaycorsproperties.go | 14 + .../model_gatewaycustomdomainproperties.go | 8 + .../model_gatewaycustomdomainresource.go | 16 + .../appplatform/model_gatewayinstance.go | 9 + ...localresponsecacheperinstanceproperties.go | 51 + ...waylocalresponsecacheperrouteproperties.go | 51 + .../model_gatewayoperatorproperties.go | 9 + .../model_gatewayoperatorresourcerequests.go | 10 + .../appplatform/model_gatewayproperties.go | 84 + .../model_gatewaypropertiesclientauth.go | 9 + ...l_gatewaypropertiesenvironmentvariables.go | 9 + .../appplatform/model_gatewayresource.go | 17 + .../model_gatewayresourcerequests.go | 9 + .../model_gatewayresponsecacheproperties.go | 83 + ...del_gatewayrouteconfigopenapiproperties.go | 8 + .../model_gatewayrouteconfigproperties.go | 15 + .../model_gatewayrouteconfigresource.go | 16 + .../appplatform/model_gitpatternrepository.go | 18 + .../appplatform/model_globallyenabledapms.go | 8 + .../appplatform/model_httpgetaction.go | 51 + .../appplatform/model_httpscalerule.go | 9 + .../model_imageregistrycredential.go | 9 + .../appplatform/model_ingressconfig.go | 8 + .../appplatform/model_ingresssettings.go | 13 + .../model_ingresssettingsclientauth.go | 8 + .../model_jaruploadedusersourceinfo.go | 54 + .../appplatform/model_jobexecution.go | 43 + .../appplatform/model_jobexecutiontemplate.go | 10 + .../appplatform/model_jobresource.go | 16 + .../model_jobresourceproperties.go | 57 + .../appplatform/model_jobresourcerequests.go | 9 + .../appplatform/model_jobtriggerconfig.go | 75 + .../model_keyvaultcertificateproperties.go | 70 + .../appplatform/model_loadedcertificate.go | 9 + .../appplatform/model_logfileurlresponse.go | 8 + .../model_maintenancescheduleconfiguration.go | 75 + .../model_managedcomponentreference.go | 8 + .../model_manualjobtriggerconfig.go | 52 + .../appplatform/model_marketplaceresource.go | 10 + .../model_monitoringsettingproperties.go | 13 + .../model_monitoringsettingresource.go | 16 + .../appplatform/model_nameavailability.go | 10 + .../model_nameavailabilityparameters.go | 9 + .../model_netcorezipuploadedusersourceinfo.go | 54 + .../appplatform/model_networkprofile.go | 16 + .../model_networkprofileoutboundips.go | 8 + .../appplatform/model_persistentdisk.go | 10 + .../model_predefinedacceleratorproperties.go | 13 + .../model_predefinedacceleratorresource.go | 17 + .../appplatform/model_probe.go | 57 + .../appplatform/model_probeaction.go | 91 + .../appplatform/model_queuescalerule.go | 10 + .../model_regeneratetestkeyrequestpayload.go | 8 + .../appplatform/model_remotedebugging.go | 9 + .../model_remotedebuggingpayload.go | 8 + .../appplatform/model_requiredtraffic.go | 12 + .../appplatform/model_resourcerequests.go | 9 + .../appplatform/model_resourcesku.go | 14 + .../model_resourceskucapabilities.go | 9 + .../model_resourceskulocationinfo.go | 14 + .../model_resourceskurestrictioninfo.go | 13 + .../model_resourceskurestrictions.go | 11 + .../model_resourceskuzonedetails.go | 9 + .../model_resourceuploaddefinition.go | 9 + .../appplatform/model_scale.go | 10 + .../appplatform/model_scalerule.go | 12 + .../appplatform/model_scaleruleauth.go | 9 + .../appplatform/model_secret.go | 9 + .../model_serviceregistryinstance.go | 9 + .../model_serviceregistryproperties.go | 10 + .../model_serviceregistryresource.go | 16 + .../model_serviceregistryresourcerequests.go | 10 + .../appplatform/model_serviceresource.go | 21 + .../appplatform/model_servicevnetaddons.go | 11 + .../appplatform/model_sku.go | 10 + .../appplatform/model_skucapacity.go | 11 + .../appplatform/model_skuobject.go | 8 + .../model_sourceuploadedusersourceinfo.go | 54 + .../appplatform/model_ssoproperties.go | 11 + .../appplatform/model_stackproperties.go | 9 + .../appplatform/model_storageaccount.go | 51 + .../appplatform/model_storageproperties.go | 75 + .../appplatform/model_storageresource.go | 53 + .../appplatform/model_supportedapmtype.go | 8 + .../model_supportedbuildpackresource.go | 16 + ...el_supportedbuildpackresourceproperties.go | 9 + .../model_supportedruntimeversion.go | 10 + .../model_supportedserverversion.go | 10 + .../model_supportedstackresource.go | 16 + .../model_supportedstackresourceproperties.go | 9 + .../appplatform/model_tcpscalerule.go | 9 + .../appplatform/model_tcpsocketaction.go | 49 + .../appplatform/model_temporarydisk.go | 9 + .../appplatform/model_testkeys.go | 12 + .../appplatform/model_triggeredbuildresult.go | 31 + .../model_uploadedusersourceinfo.go | 52 + .../appplatform/model_usersourceinfo.go | 124 + .../appplatform/model_validationmessages.go | 9 + .../model_waruploadedusersourceinfo.go | 55 + ..._weeklymaintenancescheduleconfiguration.go | 52 + .../appplatform/predicates.go | 832 +++++ .../2024-05-01-preview/appplatform/version.go | 10 + .../appplatform/2024-05-01-preview/client.go | 28 + .../customoperation/model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../2021-06-30/get/model_connectioninfo.go | 2 +- .../get/model_mongodbconnectioninfo.go | 2 +- .../serviceresource/model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../standardoperation/model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../taskresource/model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- 477 files changed, 40101 insertions(+), 12 deletions(-) create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/README.md create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/client.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/constants.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_app.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_app_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_build.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_build_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_job.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_job_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_location.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_location_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_result.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_result_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack_test.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsvalidatedomain.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslistsecretkeys.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsgetresourceuploadurl.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appssetactivedeployments.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsvalidatedomain.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingcreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglistforcluster.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoollist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolupdateput.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuildercreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlistdeployments.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdatebuild.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicedeletebuild.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuild.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresultlog.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildservice.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetresourceuploadurl.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedbuildpack.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedstack.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildresults.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuilds.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildservices.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedbuildpacks.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedstacks.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatescreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificateslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserverslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdatepatch.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdateput.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversvalidate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicescreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationserviceslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidateresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriescreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistrieslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesvalidate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsvalidate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdisableremotedebugging.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsenableremotedebugging.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgenerateheapdump.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgeneratethreaddump.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetlogfileurl.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetremotedebuggingconfig.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslistforcluster.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsrestart.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstart.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstartjfr.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstop.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserverslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdatepatch.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdateput.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayscreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslistenvsecrets.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysrestart.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysupdatecapacity.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysvalidatedomain.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobcreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutioncancel.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionlistenvsecrets.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_joblistenvsecrets.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobstart.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdatepatch.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdateput.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsdisable.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsenable.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_runtimeversionslistruntimeversions.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriescreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistrieslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceschecknameavailability.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicescreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisableapmglobally.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisabletestendpoint.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenableapmglobally.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenabletestendpoint.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesflushvnetdnssetting.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistbysubscription.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistgloballyenabledapms.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedapmtypes.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedserverversions.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslisttestkeys.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesregeneratetestkey.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstart.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstop.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_skuslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagescreateorupdate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesdelete.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesget.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/method_storageslist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorauthsetting.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorbasicauthsetting.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorgitrepository.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorpublicsetting.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorsshsetting.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_activedeploymentcollection.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmreference.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmsecretkeys.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorcomponent.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationinsightsagentversions.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewcomponent.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_appvnetaddons.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_availableruntimeversions.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_azurefilevolume.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_build.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindinglaunchproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpacksgroupproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultlog.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservice.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolsizeproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservicepropertiesresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildstageproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificatereference.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_clusterresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configservergitproperty.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettings.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingserrorrecord.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingsvalidateresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitproperty.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitpropertyvalidateresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitrepository.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettings.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettingsvalidateresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerprobesettings.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrybasiccredentials.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrycredentials.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryvalidateresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_contentcertificateproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainer.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainerusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidatepayload.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidateresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorvalidateresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_customscalerule.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentlist.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentsettings.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalcomponent.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturedetail.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturesettings.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalssoproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_diagnosticparameters.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_envsecretscollection.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_envvar.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_error.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_execaction.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapimetadataproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapiroute.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycorsproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperinstanceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperrouteproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesclientauth.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesenvironmentvariables.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresponsecacheproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigopenapiproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_gitpatternrepository.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_globallyenabledapms.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpgetaction.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpscalerule.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_imageregistrycredential.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingressconfig.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettings.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettingsclientauth.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jaruploadedusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecution.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecutiontemplate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobtriggerconfig.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_keyvaultcertificateproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_loadedcertificate.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_logfileurlresponse.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_maintenancescheduleconfiguration.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_managedcomponentreference.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_manualjobtriggerconfig.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_marketplaceresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailability.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailabilityparameters.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_netcorezipuploadedusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofile.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofileoutboundips.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_persistentdisk.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_probe.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_probeaction.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_queuescalerule.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_regeneratetestkeyrequestpayload.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebugging.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebuggingpayload.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_requiredtraffic.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcesku.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskucapabilities.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskulocationinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictioninfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictions.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskuzonedetails.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceuploaddefinition.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_scale.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_scalerule.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_scaleruleauth.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_secret.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryinstance.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresourcerequests.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_servicevnetaddons.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_sku.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_skucapacity.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_skuobject.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_sourceuploadedusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_ssoproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_stackproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageaccount.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedapmtype.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedruntimeversion.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedserverversion.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresource.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresourceproperties.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpscalerule.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpsocketaction.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_temporarydisk.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_testkeys.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_triggeredbuildresult.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_uploadedusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_usersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_validationmessages.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_waruploadedusersourceinfo.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/model_weeklymaintenancescheduleconfiguration.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/predicates.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/appplatform/version.go create mode 100644 resource-manager/appplatform/2024-05-01-preview/client.go diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/README.md b/resource-manager/appplatform/2024-05-01-preview/appplatform/README.md new file mode 100644 index 00000000000..7431fea33b8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/README.md @@ -0,0 +1,2871 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/appplatform/2024-05-01-preview/appplatform` Documentation + +The `appplatform` SDK allows for interaction with Azure Resource Manager `appplatform` (API Version `2024-05-01-preview`). + +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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/appplatform/2024-05-01-preview/appplatform" +``` + + +### Client Initialization + +```go +client := appplatform.NewAppPlatformClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AppPlatformClient.ApiPortalCustomDomainsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName", "domainName") + +payload := appplatform.ApiPortalCustomDomainResource{ + // ... +} + + +if err := client.ApiPortalCustomDomainsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalCustomDomainsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName", "domainName") + +if err := client.ApiPortalCustomDomainsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalCustomDomainsGet` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName", "domainName") + +read, err := client.ApiPortalCustomDomainsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalCustomDomainsList` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName") + +// alternatively `client.ApiPortalCustomDomainsList(ctx, id)` can be used to do batched pagination +items, err := client.ApiPortalCustomDomainsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName") + +payload := appplatform.ApiPortalResource{ + // ... +} + + +if err := client.ApiPortalsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName") + +if err := client.ApiPortalsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalsGet` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName") + +read, err := client.ApiPortalsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ApiPortalsList(ctx, id)` can be used to do batched pagination +items, err := client.ApiPortalsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ApiPortalsValidateDomain` + +```go +ctx := context.TODO() +id := appplatform.NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName") + +payload := appplatform.CustomDomainValidatePayload{ + // ... +} + + +read, err := client.ApiPortalsValidateDomain(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApmsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewApmID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apmName") + +payload := appplatform.ApmResource{ + // ... +} + + +if err := client.ApmsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApmsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewApmID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apmName") + +if err := client.ApmsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApmsGet` + +```go +ctx := context.TODO() +id := appplatform.NewApmID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apmName") + +read, err := client.ApmsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApmsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ApmsList(ctx, id)` can be used to do batched pagination +items, err := client.ApmsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ApmsListSecretKeys` + +```go +ctx := context.TODO() +id := appplatform.NewApmID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apmName") + +read, err := client.ApmsListSecretKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationAcceleratorsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName") + +payload := appplatform.ApplicationAcceleratorResource{ + // ... +} + + +if err := client.ApplicationAcceleratorsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationAcceleratorsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName") + +if err := client.ApplicationAcceleratorsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationAcceleratorsGet` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName") + +read, err := client.ApplicationAcceleratorsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationAcceleratorsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ApplicationAcceleratorsList(ctx, id)` can be used to do batched pagination +items, err := client.ApplicationAcceleratorsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationLiveViewsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationLiveViewID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationLiveViewName") + +payload := appplatform.ApplicationLiveViewResource{ + // ... +} + + +if err := client.ApplicationLiveViewsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationLiveViewsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationLiveViewID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationLiveViewName") + +if err := client.ApplicationLiveViewsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationLiveViewsGet` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationLiveViewID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationLiveViewName") + +read, err := client.ApplicationLiveViewsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ApplicationLiveViewsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ApplicationLiveViewsList(ctx, id)` can be used to do batched pagination +items, err := client.ApplicationLiveViewsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.AppsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +payload := appplatform.AppResource{ + // ... +} + + +if err := client.AppsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.AppsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +if err := client.AppsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.AppsGet` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +read, err := client.AppsGet(ctx, id, appplatform.DefaultAppsGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.AppsGetResourceUploadURL` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +read, err := client.AppsGetResourceUploadURL(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.AppsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.AppsList(ctx, id)` can be used to do batched pagination +items, err := client.AppsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.AppsSetActiveDeployments` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +payload := appplatform.ActiveDeploymentCollection{ + // ... +} + + +if err := client.AppsSetActiveDeploymentsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.AppsUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +payload := appplatform.AppResource{ + // ... +} + + +if err := client.AppsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.AppsValidateDomain` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +payload := appplatform.CustomDomainValidatePayload{ + // ... +} + + +read, err := client.AppsValidateDomain(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BindingsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "bindingName") + +payload := appplatform.BindingResource{ + // ... +} + + +if err := client.BindingsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BindingsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "bindingName") + +if err := client.BindingsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BindingsGet` + +```go +ctx := context.TODO() +id := appplatform.NewBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "bindingName") + +read, err := client.BindingsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BindingsList` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +// alternatively `client.BindingsList(ctx, id)` can be used to do batched pagination +items, err := client.BindingsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BindingsUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "bindingName") + +payload := appplatform.BindingResource{ + // ... +} + + +if err := client.BindingsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceAgentPoolGet` + +```go +ctx := context.TODO() +id := appplatform.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "agentPoolName") + +read, err := client.BuildServiceAgentPoolGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceAgentPoolList` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +// alternatively `client.BuildServiceAgentPoolList(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceAgentPoolListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceAgentPoolUpdatePut` + +```go +ctx := context.TODO() +id := appplatform.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "agentPoolName") + +payload := appplatform.BuildServiceAgentPoolResource{ + // ... +} + + +if err := client.BuildServiceAgentPoolUpdatePutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceBuilderCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName") + +payload := appplatform.BuilderResource{ + // ... +} + + +if err := client.BuildServiceBuilderCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceBuilderDelete` + +```go +ctx := context.TODO() +id := appplatform.NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName") + +if err := client.BuildServiceBuilderDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceBuilderGet` + +```go +ctx := context.TODO() +id := appplatform.NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName") + +read, err := client.BuildServiceBuilderGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceBuilderList` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +// alternatively `client.BuildServiceBuilderList(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceBuilderListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceBuilderListDeployments` + +```go +ctx := context.TODO() +id := appplatform.NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName") + +read, err := client.BuildServiceBuilderListDeployments(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +payload := appplatform.BuildService{ + // ... +} + + +if err := client.BuildServiceCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceCreateOrUpdateBuild` + +```go +ctx := context.TODO() +id := appplatform.NewBuildID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName") + +payload := appplatform.Build{ + // ... +} + + +read, err := client.BuildServiceCreateOrUpdateBuild(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceDeleteBuild` + +```go +ctx := context.TODO() +id := appplatform.NewBuildID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName") + +if err := client.BuildServiceDeleteBuildThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetBuild` + +```go +ctx := context.TODO() +id := appplatform.NewBuildID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName") + +read, err := client.BuildServiceGetBuild(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetBuildResult` + +```go +ctx := context.TODO() +id := appplatform.NewResultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName", "resultName") + +read, err := client.BuildServiceGetBuildResult(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetBuildResultLog` + +```go +ctx := context.TODO() +id := appplatform.NewResultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName", "resultName") + +read, err := client.BuildServiceGetBuildResultLog(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetBuildService` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +read, err := client.BuildServiceGetBuildService(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetResourceUploadURL` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +read, err := client.BuildServiceGetResourceUploadURL(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetSupportedBuildpack` + +```go +ctx := context.TODO() +id := appplatform.NewSupportedBuildPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "supportedBuildPackName") + +read, err := client.BuildServiceGetSupportedBuildpack(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceGetSupportedStack` + +```go +ctx := context.TODO() +id := appplatform.NewSupportedStackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "supportedStackName") + +read, err := client.BuildServiceGetSupportedStack(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceListBuildResults` + +```go +ctx := context.TODO() +id := appplatform.NewBuildID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName") + +// alternatively `client.BuildServiceListBuildResults(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceListBuildResultsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceListBuildServices` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.BuildServiceListBuildServices(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceListBuildServicesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceListBuilds` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +// alternatively `client.BuildServiceListBuilds(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceListBuildsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceListSupportedBuildpacks` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +// alternatively `client.BuildServiceListSupportedBuildpacks(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceListSupportedBuildpacksComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildServiceListSupportedStacks` + +```go +ctx := context.TODO() +id := appplatform.NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + +// alternatively `client.BuildServiceListSupportedStacks(ctx, id)` can be used to do batched pagination +items, err := client.BuildServiceListSupportedStacksComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildpackBindingCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewBuildPackBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName", "buildPackBindingName") + +payload := appplatform.BuildpackBindingResource{ + // ... +} + + +if err := client.BuildpackBindingCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildpackBindingDelete` + +```go +ctx := context.TODO() +id := appplatform.NewBuildPackBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName", "buildPackBindingName") + +if err := client.BuildpackBindingDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.BuildpackBindingGet` + +```go +ctx := context.TODO() +id := appplatform.NewBuildPackBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName", "buildPackBindingName") + +read, err := client.BuildpackBindingGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.BuildpackBindingList` + +```go +ctx := context.TODO() +id := appplatform.NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName") + +// alternatively `client.BuildpackBindingList(ctx, id)` can be used to do batched pagination +items, err := client.BuildpackBindingListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.BuildpackBindingListForCluster` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.BuildpackBindingListForCluster(ctx, id)` can be used to do batched pagination +items, err := client.BuildpackBindingListForClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.CertificatesCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "certificateName") + +payload := appplatform.CertificateResource{ + // ... +} + + +if err := client.CertificatesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CertificatesDelete` + +```go +ctx := context.TODO() +id := appplatform.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "certificateName") + +if err := client.CertificatesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CertificatesGet` + +```go +ctx := context.TODO() +id := appplatform.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "certificateName") + +read, err := client.CertificatesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.CertificatesList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.CertificatesList(ctx, id)` can be used to do batched pagination +items, err := client.CertificatesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ConfigServersDelete` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +if err := client.ConfigServersDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigServersGet` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.ConfigServersGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ConfigServersList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ConfigServersList(ctx, id)` can be used to do batched pagination +items, err := client.ConfigServersListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ConfigServersUpdatePatch` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ConfigServerResource{ + // ... +} + + +if err := client.ConfigServersUpdatePatchThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigServersUpdatePut` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ConfigServerResource{ + // ... +} + + +if err := client.ConfigServersUpdatePutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigServersValidate` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ConfigServerSettings{ + // ... +} + + +if err := client.ConfigServersValidateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigurationServicesCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName") + +payload := appplatform.ConfigurationServiceResource{ + // ... +} + + +if err := client.ConfigurationServicesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigurationServicesDelete` + +```go +ctx := context.TODO() +id := appplatform.NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName") + +if err := client.ConfigurationServicesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigurationServicesGet` + +```go +ctx := context.TODO() +id := appplatform.NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName") + +read, err := client.ConfigurationServicesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ConfigurationServicesList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ConfigurationServicesList(ctx, id)` can be used to do batched pagination +items, err := client.ConfigurationServicesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ConfigurationServicesValidate` + +```go +ctx := context.TODO() +id := appplatform.NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName") + +payload := appplatform.ConfigurationServiceSettings{ + // ... +} + + +if err := client.ConfigurationServicesValidateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ConfigurationServicesValidateResource` + +```go +ctx := context.TODO() +id := appplatform.NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName") + +payload := appplatform.ConfigurationServiceResource{ + // ... +} + + +if err := client.ConfigurationServicesValidateResourceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ContainerRegistriesCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewContainerRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "containerRegistryName") + +payload := appplatform.ContainerRegistryResource{ + // ... +} + + +if err := client.ContainerRegistriesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ContainerRegistriesDelete` + +```go +ctx := context.TODO() +id := appplatform.NewContainerRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "containerRegistryName") + +if err := client.ContainerRegistriesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ContainerRegistriesGet` + +```go +ctx := context.TODO() +id := appplatform.NewContainerRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "containerRegistryName") + +read, err := client.ContainerRegistriesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ContainerRegistriesList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ContainerRegistriesList(ctx, id)` can be used to do batched pagination +items, err := client.ContainerRegistriesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ContainerRegistriesValidate` + +```go +ctx := context.TODO() +id := appplatform.NewContainerRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "containerRegistryName") + +payload := appplatform.ContainerRegistryProperties{ + // ... +} + + +if err := client.ContainerRegistriesValidateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CustomDomainsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "domainName") + +payload := appplatform.CustomDomainResource{ + // ... +} + + +if err := client.CustomDomainsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CustomDomainsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "domainName") + +if err := client.CustomDomainsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CustomDomainsGet` + +```go +ctx := context.TODO() +id := appplatform.NewDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "domainName") + +read, err := client.CustomDomainsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.CustomDomainsList` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +// alternatively `client.CustomDomainsList(ctx, id)` can be used to do batched pagination +items, err := client.CustomDomainsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.CustomDomainsUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "domainName") + +payload := appplatform.CustomDomainResource{ + // ... +} + + +if err := client.CustomDomainsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CustomizedAcceleratorsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewCustomizedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "customizedAcceleratorName") + +payload := appplatform.CustomizedAcceleratorResource{ + // ... +} + + +if err := client.CustomizedAcceleratorsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CustomizedAcceleratorsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewCustomizedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "customizedAcceleratorName") + +if err := client.CustomizedAcceleratorsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.CustomizedAcceleratorsGet` + +```go +ctx := context.TODO() +id := appplatform.NewCustomizedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "customizedAcceleratorName") + +read, err := client.CustomizedAcceleratorsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.CustomizedAcceleratorsList` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName") + +// alternatively `client.CustomizedAcceleratorsList(ctx, id)` can be used to do batched pagination +items, err := client.CustomizedAcceleratorsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.CustomizedAcceleratorsValidate` + +```go +ctx := context.TODO() +id := appplatform.NewCustomizedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "customizedAcceleratorName") + +payload := appplatform.CustomizedAcceleratorProperties{ + // ... +} + + +if err := client.CustomizedAcceleratorsValidateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +payload := appplatform.DeploymentResource{ + // ... +} + + +if err := client.DeploymentsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +if err := client.DeploymentsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsDisableRemoteDebugging` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +if err := client.DeploymentsDisableRemoteDebuggingThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsEnableRemoteDebugging` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +payload := appplatform.RemoteDebuggingPayload{ + // ... +} + + +if err := client.DeploymentsEnableRemoteDebuggingThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsGenerateHeapDump` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +payload := appplatform.DiagnosticParameters{ + // ... +} + + +if err := client.DeploymentsGenerateHeapDumpThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsGenerateThreadDump` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +payload := appplatform.DiagnosticParameters{ + // ... +} + + +if err := client.DeploymentsGenerateThreadDumpThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsGet` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +read, err := client.DeploymentsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsGetLogFileURL` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +read, err := client.DeploymentsGetLogFileURL(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsGetRemoteDebuggingConfig` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +read, err := client.DeploymentsGetRemoteDebuggingConfig(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsList` + +```go +ctx := context.TODO() +id := appplatform.NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + +// alternatively `client.DeploymentsList(ctx, id, appplatform.DefaultDeploymentsListOperationOptions())` can be used to do batched pagination +items, err := client.DeploymentsListComplete(ctx, id, appplatform.DefaultDeploymentsListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsListForCluster` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.DeploymentsListForCluster(ctx, id, appplatform.DefaultDeploymentsListForClusterOperationOptions())` can be used to do batched pagination +items, err := client.DeploymentsListForClusterComplete(ctx, id, appplatform.DefaultDeploymentsListForClusterOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsRestart` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +if err := client.DeploymentsRestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsStart` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +if err := client.DeploymentsStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsStartJFR` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +payload := appplatform.DiagnosticParameters{ + // ... +} + + +if err := client.DeploymentsStartJFRThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsStop` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +if err := client.DeploymentsStopThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DeploymentsUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + +payload := appplatform.DeploymentResource{ + // ... +} + + +if err := client.DeploymentsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DevToolPortalsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewDevToolPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "devToolPortalName") + +payload := appplatform.DevToolPortalResource{ + // ... +} + + +if err := client.DevToolPortalsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DevToolPortalsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewDevToolPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "devToolPortalName") + +if err := client.DevToolPortalsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.DevToolPortalsGet` + +```go +ctx := context.TODO() +id := appplatform.NewDevToolPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "devToolPortalName") + +read, err := client.DevToolPortalsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.DevToolPortalsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.DevToolPortalsList(ctx, id)` can be used to do batched pagination +items, err := client.DevToolPortalsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.EurekaServersGet` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.EurekaServersGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.EurekaServersList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.EurekaServersList(ctx, id)` can be used to do batched pagination +items, err := client.EurekaServersListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.EurekaServersUpdatePatch` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.EurekaServerResource{ + // ... +} + + +if err := client.EurekaServersUpdatePatchThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.EurekaServersUpdatePut` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.EurekaServerResource{ + // ... +} + + +if err := client.EurekaServersUpdatePutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewayCustomDomainsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "domainName") + +payload := appplatform.GatewayCustomDomainResource{ + // ... +} + + +if err := client.GatewayCustomDomainsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewayCustomDomainsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "domainName") + +if err := client.GatewayCustomDomainsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewayCustomDomainsGet` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "domainName") + +read, err := client.GatewayCustomDomainsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.GatewayCustomDomainsList` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +// alternatively `client.GatewayCustomDomainsList(ctx, id)` can be used to do batched pagination +items, err := client.GatewayCustomDomainsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.GatewayRouteConfigsCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewRouteConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "routeConfigName") + +payload := appplatform.GatewayRouteConfigResource{ + // ... +} + + +if err := client.GatewayRouteConfigsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewayRouteConfigsDelete` + +```go +ctx := context.TODO() +id := appplatform.NewRouteConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "routeConfigName") + +if err := client.GatewayRouteConfigsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewayRouteConfigsGet` + +```go +ctx := context.TODO() +id := appplatform.NewRouteConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "routeConfigName") + +read, err := client.GatewayRouteConfigsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.GatewayRouteConfigsList` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +// alternatively `client.GatewayRouteConfigsList(ctx, id)` can be used to do batched pagination +items, err := client.GatewayRouteConfigsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +payload := appplatform.GatewayResource{ + // ... +} + + +if err := client.GatewaysCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysDelete` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +if err := client.GatewaysDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysGet` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +read, err := client.GatewaysGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.GatewaysList(ctx, id)` can be used to do batched pagination +items, err := client.GatewaysListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysListEnvSecrets` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +read, err := client.GatewaysListEnvSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysRestart` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +if err := client.GatewaysRestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysUpdateCapacity` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +payload := appplatform.SkuObject{ + // ... +} + + +if err := client.GatewaysUpdateCapacityThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.GatewaysValidateDomain` + +```go +ctx := context.TODO() +id := appplatform.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + +payload := appplatform.CustomDomainValidatePayload{ + // ... +} + + +read, err := client.GatewaysValidateDomain(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.JobCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + +payload := appplatform.JobResource{ + // ... +} + + +if err := client.JobCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.JobDelete` + +```go +ctx := context.TODO() +id := appplatform.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + +if err := client.JobDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.JobExecutionCancel` + +```go +ctx := context.TODO() +id := appplatform.NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName", "executionName") + +if err := client.JobExecutionCancelThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.JobExecutionGet` + +```go +ctx := context.TODO() +id := appplatform.NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName", "executionName") + +read, err := client.JobExecutionGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.JobExecutionListEnvSecrets` + +```go +ctx := context.TODO() +id := appplatform.NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName", "executionName") + +read, err := client.JobExecutionListEnvSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.JobExecutionsList` + +```go +ctx := context.TODO() +id := appplatform.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + +// alternatively `client.JobExecutionsList(ctx, id)` can be used to do batched pagination +items, err := client.JobExecutionsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.JobGet` + +```go +ctx := context.TODO() +id := appplatform.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + +read, err := client.JobGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.JobListEnvSecrets` + +```go +ctx := context.TODO() +id := appplatform.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + +read, err := client.JobListEnvSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.JobStart` + +```go +ctx := context.TODO() +id := appplatform.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + +payload := appplatform.JobExecutionTemplate{ + // ... +} + + +if err := client.JobStartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.JobsList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.JobsList(ctx, id)` can be used to do batched pagination +items, err := client.JobsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.MonitoringSettingsGet` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.MonitoringSettingsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.MonitoringSettingsUpdatePatch` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.MonitoringSettingResource{ + // ... +} + + +if err := client.MonitoringSettingsUpdatePatchThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.MonitoringSettingsUpdatePut` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.MonitoringSettingResource{ + // ... +} + + +if err := client.MonitoringSettingsUpdatePutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.PredefinedAcceleratorsDisable` + +```go +ctx := context.TODO() +id := appplatform.NewPredefinedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "predefinedAcceleratorName") + +if err := client.PredefinedAcceleratorsDisableThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.PredefinedAcceleratorsEnable` + +```go +ctx := context.TODO() +id := appplatform.NewPredefinedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "predefinedAcceleratorName") + +if err := client.PredefinedAcceleratorsEnableThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.PredefinedAcceleratorsGet` + +```go +ctx := context.TODO() +id := appplatform.NewPredefinedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "predefinedAcceleratorName") + +read, err := client.PredefinedAcceleratorsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.PredefinedAcceleratorsList` + +```go +ctx := context.TODO() +id := appplatform.NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName") + +// alternatively `client.PredefinedAcceleratorsList(ctx, id)` can be used to do batched pagination +items, err := client.PredefinedAcceleratorsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.RuntimeVersionsListRuntimeVersions` + +```go +ctx := context.TODO() + + +read, err := client.RuntimeVersionsListRuntimeVersions(ctx) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServiceRegistriesCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewServiceRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "serviceRegistryName") + +if err := client.ServiceRegistriesCreateOrUpdateThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServiceRegistriesDelete` + +```go +ctx := context.TODO() +id := appplatform.NewServiceRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "serviceRegistryName") + +if err := client.ServiceRegistriesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServiceRegistriesGet` + +```go +ctx := context.TODO() +id := appplatform.NewServiceRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "serviceRegistryName") + +read, err := client.ServiceRegistriesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServiceRegistriesList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ServiceRegistriesList(ctx, id)` can be used to do batched pagination +items, err := client.ServiceRegistriesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ServicesCheckNameAvailability` + +```go +ctx := context.TODO() +id := appplatform.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := appplatform.NameAvailabilityParameters{ + // ... +} + + +read, err := client.ServicesCheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesCreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ServiceResource{ + // ... +} + + +if err := client.ServicesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesDelete` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +if err := client.ServicesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesDisableApmGlobally` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ApmReference{ + // ... +} + + +if err := client.ServicesDisableApmGloballyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesDisableTestEndpoint` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.ServicesDisableTestEndpoint(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesEnableApmGlobally` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ApmReference{ + // ... +} + + +if err := client.ServicesEnableApmGloballyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesEnableTestEndpoint` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.ServicesEnableTestEndpoint(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesFlushVnetDnsSetting` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +if err := client.ServicesFlushVnetDnsSettingThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesGet` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.ServicesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesList` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ServicesList(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ServicesListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ServicesListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ServicesListGloballyEnabledApms` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.ServicesListGloballyEnabledApms(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesListSupportedApmTypes` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ServicesListSupportedApmTypes(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListSupportedApmTypesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ServicesListSupportedServerVersions` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.ServicesListSupportedServerVersions(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListSupportedServerVersionsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.ServicesListTestKeys` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +read, err := client.ServicesListTestKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesRegenerateTestKey` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.RegenerateTestKeyRequestPayload{ + // ... +} + + +read, err := client.ServicesRegenerateTestKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.ServicesStart` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +if err := client.ServicesStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesStop` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +if err := client.ServicesStopThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.ServicesUpdate` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +payload := appplatform.ServiceResource{ + // ... +} + + +if err := client.ServicesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.SkusList` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.SkusList(ctx, id)` can be used to do batched pagination +items, err := client.SkusListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppPlatformClient.StoragesCreateOrUpdate` + +```go +ctx := context.TODO() +id := appplatform.NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "storageName") + +payload := appplatform.StorageResource{ + // ... +} + + +if err := client.StoragesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.StoragesDelete` + +```go +ctx := context.TODO() +id := appplatform.NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "storageName") + +if err := client.StoragesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppPlatformClient.StoragesGet` + +```go +ctx := context.TODO() +id := appplatform.NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "storageName") + +read, err := client.StoragesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppPlatformClient.StoragesList` + +```go +ctx := context.TODO() +id := commonids.NewSpringCloudServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName") + +// alternatively `client.StoragesList(ctx, id)` can be used to do batched pagination +items, err := client.StoragesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/client.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/client.go new file mode 100644 index 00000000000..8165dad21d6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/client.go @@ -0,0 +1,26 @@ +package appplatform + +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 AppPlatformClient struct { + Client *resourcemanager.Client +} + +func NewAppPlatformClientWithBaseURI(sdkApi sdkEnv.Api) (*AppPlatformClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "appplatform", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AppPlatformClient: %+v", err) + } + + return &AppPlatformClient{ + Client: client, + }, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/constants.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/constants.go new file mode 100644 index 00000000000..13d561991d8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/constants.go @@ -0,0 +1,2882 @@ +package appplatform + +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 ApiPortalApiTryOutEnabledState string + +const ( + ApiPortalApiTryOutEnabledStateDisabled ApiPortalApiTryOutEnabledState = "Disabled" + ApiPortalApiTryOutEnabledStateEnabled ApiPortalApiTryOutEnabledState = "Enabled" +) + +func PossibleValuesForApiPortalApiTryOutEnabledState() []string { + return []string{ + string(ApiPortalApiTryOutEnabledStateDisabled), + string(ApiPortalApiTryOutEnabledStateEnabled), + } +} + +func (s *ApiPortalApiTryOutEnabledState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiPortalApiTryOutEnabledState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApiPortalApiTryOutEnabledState(input string) (*ApiPortalApiTryOutEnabledState, error) { + vals := map[string]ApiPortalApiTryOutEnabledState{ + "disabled": ApiPortalApiTryOutEnabledStateDisabled, + "enabled": ApiPortalApiTryOutEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApiPortalApiTryOutEnabledState(input) + return &out, nil +} + +type ApiPortalProvisioningState string + +const ( + ApiPortalProvisioningStateCreating ApiPortalProvisioningState = "Creating" + ApiPortalProvisioningStateDeleting ApiPortalProvisioningState = "Deleting" + ApiPortalProvisioningStateFailed ApiPortalProvisioningState = "Failed" + ApiPortalProvisioningStateSucceeded ApiPortalProvisioningState = "Succeeded" + ApiPortalProvisioningStateUpdating ApiPortalProvisioningState = "Updating" +) + +func PossibleValuesForApiPortalProvisioningState() []string { + return []string{ + string(ApiPortalProvisioningStateCreating), + string(ApiPortalProvisioningStateDeleting), + string(ApiPortalProvisioningStateFailed), + string(ApiPortalProvisioningStateSucceeded), + string(ApiPortalProvisioningStateUpdating), + } +} + +func (s *ApiPortalProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiPortalProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApiPortalProvisioningState(input string) (*ApiPortalProvisioningState, error) { + vals := map[string]ApiPortalProvisioningState{ + "creating": ApiPortalProvisioningStateCreating, + "deleting": ApiPortalProvisioningStateDeleting, + "failed": ApiPortalProvisioningStateFailed, + "succeeded": ApiPortalProvisioningStateSucceeded, + "updating": ApiPortalProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApiPortalProvisioningState(input) + return &out, nil +} + +type ApmProvisioningState string + +const ( + ApmProvisioningStateCanceled ApmProvisioningState = "Canceled" + ApmProvisioningStateCreating ApmProvisioningState = "Creating" + ApmProvisioningStateDeleting ApmProvisioningState = "Deleting" + ApmProvisioningStateFailed ApmProvisioningState = "Failed" + ApmProvisioningStateSucceeded ApmProvisioningState = "Succeeded" + ApmProvisioningStateUpdating ApmProvisioningState = "Updating" +) + +func PossibleValuesForApmProvisioningState() []string { + return []string{ + string(ApmProvisioningStateCanceled), + string(ApmProvisioningStateCreating), + string(ApmProvisioningStateDeleting), + string(ApmProvisioningStateFailed), + string(ApmProvisioningStateSucceeded), + string(ApmProvisioningStateUpdating), + } +} + +func (s *ApmProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApmProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApmProvisioningState(input string) (*ApmProvisioningState, error) { + vals := map[string]ApmProvisioningState{ + "canceled": ApmProvisioningStateCanceled, + "creating": ApmProvisioningStateCreating, + "deleting": ApmProvisioningStateDeleting, + "failed": ApmProvisioningStateFailed, + "succeeded": ApmProvisioningStateSucceeded, + "updating": ApmProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApmProvisioningState(input) + return &out, nil +} + +type ApmType string + +const ( + ApmTypeAppDynamics ApmType = "AppDynamics" + ApmTypeApplicationInsights ApmType = "ApplicationInsights" + ApmTypeDynatrace ApmType = "Dynatrace" + ApmTypeElasticAPM ApmType = "ElasticAPM" + ApmTypeNewRelic ApmType = "NewRelic" +) + +func PossibleValuesForApmType() []string { + return []string{ + string(ApmTypeAppDynamics), + string(ApmTypeApplicationInsights), + string(ApmTypeDynatrace), + string(ApmTypeElasticAPM), + string(ApmTypeNewRelic), + } +} + +func (s *ApmType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApmType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApmType(input string) (*ApmType, error) { + vals := map[string]ApmType{ + "appdynamics": ApmTypeAppDynamics, + "applicationinsights": ApmTypeApplicationInsights, + "dynatrace": ApmTypeDynatrace, + "elasticapm": ApmTypeElasticAPM, + "newrelic": ApmTypeNewRelic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApmType(input) + return &out, nil +} + +type AppResourceProvisioningState string + +const ( + AppResourceProvisioningStateCreating AppResourceProvisioningState = "Creating" + AppResourceProvisioningStateDeleting AppResourceProvisioningState = "Deleting" + AppResourceProvisioningStateFailed AppResourceProvisioningState = "Failed" + AppResourceProvisioningStateSucceeded AppResourceProvisioningState = "Succeeded" + AppResourceProvisioningStateUpdating AppResourceProvisioningState = "Updating" +) + +func PossibleValuesForAppResourceProvisioningState() []string { + return []string{ + string(AppResourceProvisioningStateCreating), + string(AppResourceProvisioningStateDeleting), + string(AppResourceProvisioningStateFailed), + string(AppResourceProvisioningStateSucceeded), + string(AppResourceProvisioningStateUpdating), + } +} + +func (s *AppResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAppResourceProvisioningState(input string) (*AppResourceProvisioningState, error) { + vals := map[string]AppResourceProvisioningState{ + "creating": AppResourceProvisioningStateCreating, + "deleting": AppResourceProvisioningStateDeleting, + "failed": AppResourceProvisioningStateFailed, + "succeeded": AppResourceProvisioningStateSucceeded, + "updating": AppResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AppResourceProvisioningState(input) + return &out, nil +} + +type ApplicationAcceleratorProvisioningState string + +const ( + ApplicationAcceleratorProvisioningStateCanceled ApplicationAcceleratorProvisioningState = "Canceled" + ApplicationAcceleratorProvisioningStateCreating ApplicationAcceleratorProvisioningState = "Creating" + ApplicationAcceleratorProvisioningStateDeleting ApplicationAcceleratorProvisioningState = "Deleting" + ApplicationAcceleratorProvisioningStateFailed ApplicationAcceleratorProvisioningState = "Failed" + ApplicationAcceleratorProvisioningStateSucceeded ApplicationAcceleratorProvisioningState = "Succeeded" + ApplicationAcceleratorProvisioningStateUpdating ApplicationAcceleratorProvisioningState = "Updating" +) + +func PossibleValuesForApplicationAcceleratorProvisioningState() []string { + return []string{ + string(ApplicationAcceleratorProvisioningStateCanceled), + string(ApplicationAcceleratorProvisioningStateCreating), + string(ApplicationAcceleratorProvisioningStateDeleting), + string(ApplicationAcceleratorProvisioningStateFailed), + string(ApplicationAcceleratorProvisioningStateSucceeded), + string(ApplicationAcceleratorProvisioningStateUpdating), + } +} + +func (s *ApplicationAcceleratorProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationAcceleratorProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationAcceleratorProvisioningState(input string) (*ApplicationAcceleratorProvisioningState, error) { + vals := map[string]ApplicationAcceleratorProvisioningState{ + "canceled": ApplicationAcceleratorProvisioningStateCanceled, + "creating": ApplicationAcceleratorProvisioningStateCreating, + "deleting": ApplicationAcceleratorProvisioningStateDeleting, + "failed": ApplicationAcceleratorProvisioningStateFailed, + "succeeded": ApplicationAcceleratorProvisioningStateSucceeded, + "updating": ApplicationAcceleratorProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationAcceleratorProvisioningState(input) + return &out, nil +} + +type ApplicationLiveViewProvisioningState string + +const ( + ApplicationLiveViewProvisioningStateCanceled ApplicationLiveViewProvisioningState = "Canceled" + ApplicationLiveViewProvisioningStateCreating ApplicationLiveViewProvisioningState = "Creating" + ApplicationLiveViewProvisioningStateDeleting ApplicationLiveViewProvisioningState = "Deleting" + ApplicationLiveViewProvisioningStateFailed ApplicationLiveViewProvisioningState = "Failed" + ApplicationLiveViewProvisioningStateSucceeded ApplicationLiveViewProvisioningState = "Succeeded" + ApplicationLiveViewProvisioningStateUpdating ApplicationLiveViewProvisioningState = "Updating" +) + +func PossibleValuesForApplicationLiveViewProvisioningState() []string { + return []string{ + string(ApplicationLiveViewProvisioningStateCanceled), + string(ApplicationLiveViewProvisioningStateCreating), + string(ApplicationLiveViewProvisioningStateDeleting), + string(ApplicationLiveViewProvisioningStateFailed), + string(ApplicationLiveViewProvisioningStateSucceeded), + string(ApplicationLiveViewProvisioningStateUpdating), + } +} + +func (s *ApplicationLiveViewProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationLiveViewProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationLiveViewProvisioningState(input string) (*ApplicationLiveViewProvisioningState, error) { + vals := map[string]ApplicationLiveViewProvisioningState{ + "canceled": ApplicationLiveViewProvisioningStateCanceled, + "creating": ApplicationLiveViewProvisioningStateCreating, + "deleting": ApplicationLiveViewProvisioningStateDeleting, + "failed": ApplicationLiveViewProvisioningStateFailed, + "succeeded": ApplicationLiveViewProvisioningStateSucceeded, + "updating": ApplicationLiveViewProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationLiveViewProvisioningState(input) + return &out, nil +} + +type BackendProtocol string + +const ( + BackendProtocolDefault BackendProtocol = "Default" + BackendProtocolGRPC BackendProtocol = "GRPC" +) + +func PossibleValuesForBackendProtocol() []string { + return []string{ + string(BackendProtocolDefault), + string(BackendProtocolGRPC), + } +} + +func (s *BackendProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBackendProtocol(input string) (*BackendProtocol, error) { + vals := map[string]BackendProtocol{ + "default": BackendProtocolDefault, + "grpc": BackendProtocolGRPC, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackendProtocol(input) + return &out, nil +} + +type BindingType string + +const ( + BindingTypeApacheSkyWalking BindingType = "ApacheSkyWalking" + BindingTypeAppDynamics BindingType = "AppDynamics" + BindingTypeApplicationInsights BindingType = "ApplicationInsights" + BindingTypeCACertificates BindingType = "CACertificates" + BindingTypeDynatrace BindingType = "Dynatrace" + BindingTypeElasticAPM BindingType = "ElasticAPM" + BindingTypeNewRelic BindingType = "NewRelic" +) + +func PossibleValuesForBindingType() []string { + return []string{ + string(BindingTypeApacheSkyWalking), + string(BindingTypeAppDynamics), + string(BindingTypeApplicationInsights), + string(BindingTypeCACertificates), + string(BindingTypeDynatrace), + string(BindingTypeElasticAPM), + string(BindingTypeNewRelic), + } +} + +func (s *BindingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBindingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBindingType(input string) (*BindingType, error) { + vals := map[string]BindingType{ + "apacheskywalking": BindingTypeApacheSkyWalking, + "appdynamics": BindingTypeAppDynamics, + "applicationinsights": BindingTypeApplicationInsights, + "cacertificates": BindingTypeCACertificates, + "dynatrace": BindingTypeDynatrace, + "elasticapm": BindingTypeElasticAPM, + "newrelic": BindingTypeNewRelic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BindingType(input) + return &out, nil +} + +type BuildProvisioningState string + +const ( + BuildProvisioningStateCreating BuildProvisioningState = "Creating" + BuildProvisioningStateDeleting BuildProvisioningState = "Deleting" + BuildProvisioningStateFailed BuildProvisioningState = "Failed" + BuildProvisioningStateSucceeded BuildProvisioningState = "Succeeded" + BuildProvisioningStateUpdating BuildProvisioningState = "Updating" +) + +func PossibleValuesForBuildProvisioningState() []string { + return []string{ + string(BuildProvisioningStateCreating), + string(BuildProvisioningStateDeleting), + string(BuildProvisioningStateFailed), + string(BuildProvisioningStateSucceeded), + string(BuildProvisioningStateUpdating), + } +} + +func (s *BuildProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBuildProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBuildProvisioningState(input string) (*BuildProvisioningState, error) { + vals := map[string]BuildProvisioningState{ + "creating": BuildProvisioningStateCreating, + "deleting": BuildProvisioningStateDeleting, + "failed": BuildProvisioningStateFailed, + "succeeded": BuildProvisioningStateSucceeded, + "updating": BuildProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BuildProvisioningState(input) + return &out, nil +} + +type BuildResultProvisioningState string + +const ( + BuildResultProvisioningStateBuilding BuildResultProvisioningState = "Building" + BuildResultProvisioningStateDeleting BuildResultProvisioningState = "Deleting" + BuildResultProvisioningStateFailed BuildResultProvisioningState = "Failed" + BuildResultProvisioningStateQueuing BuildResultProvisioningState = "Queuing" + BuildResultProvisioningStateSucceeded BuildResultProvisioningState = "Succeeded" +) + +func PossibleValuesForBuildResultProvisioningState() []string { + return []string{ + string(BuildResultProvisioningStateBuilding), + string(BuildResultProvisioningStateDeleting), + string(BuildResultProvisioningStateFailed), + string(BuildResultProvisioningStateQueuing), + string(BuildResultProvisioningStateSucceeded), + } +} + +func (s *BuildResultProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBuildResultProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBuildResultProvisioningState(input string) (*BuildResultProvisioningState, error) { + vals := map[string]BuildResultProvisioningState{ + "building": BuildResultProvisioningStateBuilding, + "deleting": BuildResultProvisioningStateDeleting, + "failed": BuildResultProvisioningStateFailed, + "queuing": BuildResultProvisioningStateQueuing, + "succeeded": BuildResultProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BuildResultProvisioningState(input) + return &out, nil +} + +type BuildServiceProvisioningState string + +const ( + BuildServiceProvisioningStateCreating BuildServiceProvisioningState = "Creating" + BuildServiceProvisioningStateDeleting BuildServiceProvisioningState = "Deleting" + BuildServiceProvisioningStateFailed BuildServiceProvisioningState = "Failed" + BuildServiceProvisioningStateSucceeded BuildServiceProvisioningState = "Succeeded" + BuildServiceProvisioningStateUpdating BuildServiceProvisioningState = "Updating" +) + +func PossibleValuesForBuildServiceProvisioningState() []string { + return []string{ + string(BuildServiceProvisioningStateCreating), + string(BuildServiceProvisioningStateDeleting), + string(BuildServiceProvisioningStateFailed), + string(BuildServiceProvisioningStateSucceeded), + string(BuildServiceProvisioningStateUpdating), + } +} + +func (s *BuildServiceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBuildServiceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBuildServiceProvisioningState(input string) (*BuildServiceProvisioningState, error) { + vals := map[string]BuildServiceProvisioningState{ + "creating": BuildServiceProvisioningStateCreating, + "deleting": BuildServiceProvisioningStateDeleting, + "failed": BuildServiceProvisioningStateFailed, + "succeeded": BuildServiceProvisioningStateSucceeded, + "updating": BuildServiceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BuildServiceProvisioningState(input) + return &out, nil +} + +type BuilderProvisioningState string + +const ( + BuilderProvisioningStateCreating BuilderProvisioningState = "Creating" + BuilderProvisioningStateDeleting BuilderProvisioningState = "Deleting" + BuilderProvisioningStateFailed BuilderProvisioningState = "Failed" + BuilderProvisioningStateSucceeded BuilderProvisioningState = "Succeeded" + BuilderProvisioningStateUpdating BuilderProvisioningState = "Updating" +) + +func PossibleValuesForBuilderProvisioningState() []string { + return []string{ + string(BuilderProvisioningStateCreating), + string(BuilderProvisioningStateDeleting), + string(BuilderProvisioningStateFailed), + string(BuilderProvisioningStateSucceeded), + string(BuilderProvisioningStateUpdating), + } +} + +func (s *BuilderProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBuilderProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBuilderProvisioningState(input string) (*BuilderProvisioningState, error) { + vals := map[string]BuilderProvisioningState{ + "creating": BuilderProvisioningStateCreating, + "deleting": BuilderProvisioningStateDeleting, + "failed": BuilderProvisioningStateFailed, + "succeeded": BuilderProvisioningStateSucceeded, + "updating": BuilderProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BuilderProvisioningState(input) + return &out, nil +} + +type BuildpackBindingProvisioningState string + +const ( + BuildpackBindingProvisioningStateCreating BuildpackBindingProvisioningState = "Creating" + BuildpackBindingProvisioningStateDeleting BuildpackBindingProvisioningState = "Deleting" + BuildpackBindingProvisioningStateFailed BuildpackBindingProvisioningState = "Failed" + BuildpackBindingProvisioningStateSucceeded BuildpackBindingProvisioningState = "Succeeded" + BuildpackBindingProvisioningStateUpdating BuildpackBindingProvisioningState = "Updating" +) + +func PossibleValuesForBuildpackBindingProvisioningState() []string { + return []string{ + string(BuildpackBindingProvisioningStateCreating), + string(BuildpackBindingProvisioningStateDeleting), + string(BuildpackBindingProvisioningStateFailed), + string(BuildpackBindingProvisioningStateSucceeded), + string(BuildpackBindingProvisioningStateUpdating), + } +} + +func (s *BuildpackBindingProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBuildpackBindingProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBuildpackBindingProvisioningState(input string) (*BuildpackBindingProvisioningState, error) { + vals := map[string]BuildpackBindingProvisioningState{ + "creating": BuildpackBindingProvisioningStateCreating, + "deleting": BuildpackBindingProvisioningStateDeleting, + "failed": BuildpackBindingProvisioningStateFailed, + "succeeded": BuildpackBindingProvisioningStateSucceeded, + "updating": BuildpackBindingProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BuildpackBindingProvisioningState(input) + return &out, nil +} + +type CertificateResourceProvisioningState string + +const ( + CertificateResourceProvisioningStateCreating CertificateResourceProvisioningState = "Creating" + CertificateResourceProvisioningStateDeleting CertificateResourceProvisioningState = "Deleting" + CertificateResourceProvisioningStateFailed CertificateResourceProvisioningState = "Failed" + CertificateResourceProvisioningStateSucceeded CertificateResourceProvisioningState = "Succeeded" + CertificateResourceProvisioningStateUpdating CertificateResourceProvisioningState = "Updating" +) + +func PossibleValuesForCertificateResourceProvisioningState() []string { + return []string{ + string(CertificateResourceProvisioningStateCreating), + string(CertificateResourceProvisioningStateDeleting), + string(CertificateResourceProvisioningStateFailed), + string(CertificateResourceProvisioningStateSucceeded), + string(CertificateResourceProvisioningStateUpdating), + } +} + +func (s *CertificateResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCertificateResourceProvisioningState(input string) (*CertificateResourceProvisioningState, error) { + vals := map[string]CertificateResourceProvisioningState{ + "creating": CertificateResourceProvisioningStateCreating, + "deleting": CertificateResourceProvisioningStateDeleting, + "failed": CertificateResourceProvisioningStateFailed, + "succeeded": CertificateResourceProvisioningStateSucceeded, + "updating": CertificateResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateResourceProvisioningState(input) + return &out, nil +} + +type ConfigServerEnabledState string + +const ( + ConfigServerEnabledStateDisabled ConfigServerEnabledState = "Disabled" + ConfigServerEnabledStateEnabled ConfigServerEnabledState = "Enabled" +) + +func PossibleValuesForConfigServerEnabledState() []string { + return []string{ + string(ConfigServerEnabledStateDisabled), + string(ConfigServerEnabledStateEnabled), + } +} + +func (s *ConfigServerEnabledState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfigServerEnabledState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfigServerEnabledState(input string) (*ConfigServerEnabledState, error) { + vals := map[string]ConfigServerEnabledState{ + "disabled": ConfigServerEnabledStateDisabled, + "enabled": ConfigServerEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigServerEnabledState(input) + return &out, nil +} + +type ConfigServerState string + +const ( + ConfigServerStateCreating ConfigServerState = "Creating" + ConfigServerStateDeleted ConfigServerState = "Deleted" + ConfigServerStateDeleting ConfigServerState = "Deleting" + ConfigServerStateFailed ConfigServerState = "Failed" + ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" + ConfigServerStateSucceeded ConfigServerState = "Succeeded" + ConfigServerStateUpdating ConfigServerState = "Updating" +) + +func PossibleValuesForConfigServerState() []string { + return []string{ + string(ConfigServerStateCreating), + string(ConfigServerStateDeleted), + string(ConfigServerStateDeleting), + string(ConfigServerStateFailed), + string(ConfigServerStateNotAvailable), + string(ConfigServerStateSucceeded), + string(ConfigServerStateUpdating), + } +} + +func (s *ConfigServerState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfigServerState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfigServerState(input string) (*ConfigServerState, error) { + vals := map[string]ConfigServerState{ + "creating": ConfigServerStateCreating, + "deleted": ConfigServerStateDeleted, + "deleting": ConfigServerStateDeleting, + "failed": ConfigServerStateFailed, + "notavailable": ConfigServerStateNotAvailable, + "succeeded": ConfigServerStateSucceeded, + "updating": ConfigServerStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigServerState(input) + return &out, nil +} + +type ConfigurationServiceGeneration string + +const ( + ConfigurationServiceGenerationGenOne ConfigurationServiceGeneration = "Gen1" + ConfigurationServiceGenerationGenTwo ConfigurationServiceGeneration = "Gen2" +) + +func PossibleValuesForConfigurationServiceGeneration() []string { + return []string{ + string(ConfigurationServiceGenerationGenOne), + string(ConfigurationServiceGenerationGenTwo), + } +} + +func (s *ConfigurationServiceGeneration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfigurationServiceGeneration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfigurationServiceGeneration(input string) (*ConfigurationServiceGeneration, error) { + vals := map[string]ConfigurationServiceGeneration{ + "gen1": ConfigurationServiceGenerationGenOne, + "gen2": ConfigurationServiceGenerationGenTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigurationServiceGeneration(input) + return &out, nil +} + +type ConfigurationServiceProvisioningState string + +const ( + ConfigurationServiceProvisioningStateCreating ConfigurationServiceProvisioningState = "Creating" + ConfigurationServiceProvisioningStateDeleting ConfigurationServiceProvisioningState = "Deleting" + ConfigurationServiceProvisioningStateFailed ConfigurationServiceProvisioningState = "Failed" + ConfigurationServiceProvisioningStateSucceeded ConfigurationServiceProvisioningState = "Succeeded" + ConfigurationServiceProvisioningStateUpdating ConfigurationServiceProvisioningState = "Updating" +) + +func PossibleValuesForConfigurationServiceProvisioningState() []string { + return []string{ + string(ConfigurationServiceProvisioningStateCreating), + string(ConfigurationServiceProvisioningStateDeleting), + string(ConfigurationServiceProvisioningStateFailed), + string(ConfigurationServiceProvisioningStateSucceeded), + string(ConfigurationServiceProvisioningStateUpdating), + } +} + +func (s *ConfigurationServiceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfigurationServiceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfigurationServiceProvisioningState(input string) (*ConfigurationServiceProvisioningState, error) { + vals := map[string]ConfigurationServiceProvisioningState{ + "creating": ConfigurationServiceProvisioningStateCreating, + "deleting": ConfigurationServiceProvisioningStateDeleting, + "failed": ConfigurationServiceProvisioningStateFailed, + "succeeded": ConfigurationServiceProvisioningStateSucceeded, + "updating": ConfigurationServiceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigurationServiceProvisioningState(input) + return &out, nil +} + +type ContainerRegistryProvisioningState string + +const ( + ContainerRegistryProvisioningStateCanceled ContainerRegistryProvisioningState = "Canceled" + ContainerRegistryProvisioningStateCreating ContainerRegistryProvisioningState = "Creating" + ContainerRegistryProvisioningStateDeleting ContainerRegistryProvisioningState = "Deleting" + ContainerRegistryProvisioningStateFailed ContainerRegistryProvisioningState = "Failed" + ContainerRegistryProvisioningStateSucceeded ContainerRegistryProvisioningState = "Succeeded" + ContainerRegistryProvisioningStateUpdating ContainerRegistryProvisioningState = "Updating" +) + +func PossibleValuesForContainerRegistryProvisioningState() []string { + return []string{ + string(ContainerRegistryProvisioningStateCanceled), + string(ContainerRegistryProvisioningStateCreating), + string(ContainerRegistryProvisioningStateDeleting), + string(ContainerRegistryProvisioningStateFailed), + string(ContainerRegistryProvisioningStateSucceeded), + string(ContainerRegistryProvisioningStateUpdating), + } +} + +func (s *ContainerRegistryProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerRegistryProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerRegistryProvisioningState(input string) (*ContainerRegistryProvisioningState, error) { + vals := map[string]ContainerRegistryProvisioningState{ + "canceled": ContainerRegistryProvisioningStateCanceled, + "creating": ContainerRegistryProvisioningStateCreating, + "deleting": ContainerRegistryProvisioningStateDeleting, + "failed": ContainerRegistryProvisioningStateFailed, + "succeeded": ContainerRegistryProvisioningStateSucceeded, + "updating": ContainerRegistryProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerRegistryProvisioningState(input) + return &out, nil +} + +type CustomDomainResourceProvisioningState string + +const ( + CustomDomainResourceProvisioningStateCreating CustomDomainResourceProvisioningState = "Creating" + CustomDomainResourceProvisioningStateDeleting CustomDomainResourceProvisioningState = "Deleting" + CustomDomainResourceProvisioningStateFailed CustomDomainResourceProvisioningState = "Failed" + CustomDomainResourceProvisioningStateSucceeded CustomDomainResourceProvisioningState = "Succeeded" + CustomDomainResourceProvisioningStateUpdating CustomDomainResourceProvisioningState = "Updating" +) + +func PossibleValuesForCustomDomainResourceProvisioningState() []string { + return []string{ + string(CustomDomainResourceProvisioningStateCreating), + string(CustomDomainResourceProvisioningStateDeleting), + string(CustomDomainResourceProvisioningStateFailed), + string(CustomDomainResourceProvisioningStateSucceeded), + string(CustomDomainResourceProvisioningStateUpdating), + } +} + +func (s *CustomDomainResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCustomDomainResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCustomDomainResourceProvisioningState(input string) (*CustomDomainResourceProvisioningState, error) { + vals := map[string]CustomDomainResourceProvisioningState{ + "creating": CustomDomainResourceProvisioningStateCreating, + "deleting": CustomDomainResourceProvisioningStateDeleting, + "failed": CustomDomainResourceProvisioningStateFailed, + "succeeded": CustomDomainResourceProvisioningStateSucceeded, + "updating": CustomDomainResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomDomainResourceProvisioningState(input) + return &out, nil +} + +type CustomizedAcceleratorProvisioningState string + +const ( + CustomizedAcceleratorProvisioningStateCanceled CustomizedAcceleratorProvisioningState = "Canceled" + CustomizedAcceleratorProvisioningStateCreating CustomizedAcceleratorProvisioningState = "Creating" + CustomizedAcceleratorProvisioningStateDeleting CustomizedAcceleratorProvisioningState = "Deleting" + CustomizedAcceleratorProvisioningStateFailed CustomizedAcceleratorProvisioningState = "Failed" + CustomizedAcceleratorProvisioningStateSucceeded CustomizedAcceleratorProvisioningState = "Succeeded" + CustomizedAcceleratorProvisioningStateUpdating CustomizedAcceleratorProvisioningState = "Updating" +) + +func PossibleValuesForCustomizedAcceleratorProvisioningState() []string { + return []string{ + string(CustomizedAcceleratorProvisioningStateCanceled), + string(CustomizedAcceleratorProvisioningStateCreating), + string(CustomizedAcceleratorProvisioningStateDeleting), + string(CustomizedAcceleratorProvisioningStateFailed), + string(CustomizedAcceleratorProvisioningStateSucceeded), + string(CustomizedAcceleratorProvisioningStateUpdating), + } +} + +func (s *CustomizedAcceleratorProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCustomizedAcceleratorProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCustomizedAcceleratorProvisioningState(input string) (*CustomizedAcceleratorProvisioningState, error) { + vals := map[string]CustomizedAcceleratorProvisioningState{ + "canceled": CustomizedAcceleratorProvisioningStateCanceled, + "creating": CustomizedAcceleratorProvisioningStateCreating, + "deleting": CustomizedAcceleratorProvisioningStateDeleting, + "failed": CustomizedAcceleratorProvisioningStateFailed, + "succeeded": CustomizedAcceleratorProvisioningStateSucceeded, + "updating": CustomizedAcceleratorProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomizedAcceleratorProvisioningState(input) + return &out, nil +} + +type CustomizedAcceleratorType string + +const ( + CustomizedAcceleratorTypeAccelerator CustomizedAcceleratorType = "Accelerator" + CustomizedAcceleratorTypeFragment CustomizedAcceleratorType = "Fragment" +) + +func PossibleValuesForCustomizedAcceleratorType() []string { + return []string{ + string(CustomizedAcceleratorTypeAccelerator), + string(CustomizedAcceleratorTypeFragment), + } +} + +func (s *CustomizedAcceleratorType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCustomizedAcceleratorType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCustomizedAcceleratorType(input string) (*CustomizedAcceleratorType, error) { + vals := map[string]CustomizedAcceleratorType{ + "accelerator": CustomizedAcceleratorTypeAccelerator, + "fragment": CustomizedAcceleratorTypeFragment, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomizedAcceleratorType(input) + return &out, nil +} + +type CustomizedAcceleratorValidateResultState string + +const ( + CustomizedAcceleratorValidateResultStateInvalid CustomizedAcceleratorValidateResultState = "Invalid" + CustomizedAcceleratorValidateResultStateValid CustomizedAcceleratorValidateResultState = "Valid" +) + +func PossibleValuesForCustomizedAcceleratorValidateResultState() []string { + return []string{ + string(CustomizedAcceleratorValidateResultStateInvalid), + string(CustomizedAcceleratorValidateResultStateValid), + } +} + +func (s *CustomizedAcceleratorValidateResultState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCustomizedAcceleratorValidateResultState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCustomizedAcceleratorValidateResultState(input string) (*CustomizedAcceleratorValidateResultState, error) { + vals := map[string]CustomizedAcceleratorValidateResultState{ + "invalid": CustomizedAcceleratorValidateResultStateInvalid, + "valid": CustomizedAcceleratorValidateResultStateValid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomizedAcceleratorValidateResultState(input) + return &out, nil +} + +type DeploymentResourceProvisioningState string + +const ( + DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" + DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" + DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" + DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" +) + +func PossibleValuesForDeploymentResourceProvisioningState() []string { + return []string{ + string(DeploymentResourceProvisioningStateCreating), + string(DeploymentResourceProvisioningStateFailed), + string(DeploymentResourceProvisioningStateSucceeded), + string(DeploymentResourceProvisioningStateUpdating), + } +} + +func (s *DeploymentResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeploymentResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeploymentResourceProvisioningState(input string) (*DeploymentResourceProvisioningState, error) { + vals := map[string]DeploymentResourceProvisioningState{ + "creating": DeploymentResourceProvisioningStateCreating, + "failed": DeploymentResourceProvisioningStateFailed, + "succeeded": DeploymentResourceProvisioningStateSucceeded, + "updating": DeploymentResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeploymentResourceProvisioningState(input) + return &out, nil +} + +type DeploymentResourceStatus string + +const ( + DeploymentResourceStatusRunning DeploymentResourceStatus = "Running" + DeploymentResourceStatusStopped DeploymentResourceStatus = "Stopped" +) + +func PossibleValuesForDeploymentResourceStatus() []string { + return []string{ + string(DeploymentResourceStatusRunning), + string(DeploymentResourceStatusStopped), + } +} + +func (s *DeploymentResourceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeploymentResourceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeploymentResourceStatus(input string) (*DeploymentResourceStatus, error) { + vals := map[string]DeploymentResourceStatus{ + "running": DeploymentResourceStatusRunning, + "stopped": DeploymentResourceStatusStopped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeploymentResourceStatus(input) + return &out, nil +} + +type DevToolPortalFeatureState string + +const ( + DevToolPortalFeatureStateDisabled DevToolPortalFeatureState = "Disabled" + DevToolPortalFeatureStateEnabled DevToolPortalFeatureState = "Enabled" +) + +func PossibleValuesForDevToolPortalFeatureState() []string { + return []string{ + string(DevToolPortalFeatureStateDisabled), + string(DevToolPortalFeatureStateEnabled), + } +} + +func (s *DevToolPortalFeatureState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDevToolPortalFeatureState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDevToolPortalFeatureState(input string) (*DevToolPortalFeatureState, error) { + vals := map[string]DevToolPortalFeatureState{ + "disabled": DevToolPortalFeatureStateDisabled, + "enabled": DevToolPortalFeatureStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DevToolPortalFeatureState(input) + return &out, nil +} + +type DevToolPortalProvisioningState string + +const ( + DevToolPortalProvisioningStateCanceled DevToolPortalProvisioningState = "Canceled" + DevToolPortalProvisioningStateCreating DevToolPortalProvisioningState = "Creating" + DevToolPortalProvisioningStateDeleting DevToolPortalProvisioningState = "Deleting" + DevToolPortalProvisioningStateFailed DevToolPortalProvisioningState = "Failed" + DevToolPortalProvisioningStateSucceeded DevToolPortalProvisioningState = "Succeeded" + DevToolPortalProvisioningStateUpdating DevToolPortalProvisioningState = "Updating" +) + +func PossibleValuesForDevToolPortalProvisioningState() []string { + return []string{ + string(DevToolPortalProvisioningStateCanceled), + string(DevToolPortalProvisioningStateCreating), + string(DevToolPortalProvisioningStateDeleting), + string(DevToolPortalProvisioningStateFailed), + string(DevToolPortalProvisioningStateSucceeded), + string(DevToolPortalProvisioningStateUpdating), + } +} + +func (s *DevToolPortalProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDevToolPortalProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDevToolPortalProvisioningState(input string) (*DevToolPortalProvisioningState, error) { + vals := map[string]DevToolPortalProvisioningState{ + "canceled": DevToolPortalProvisioningStateCanceled, + "creating": DevToolPortalProvisioningStateCreating, + "deleting": DevToolPortalProvisioningStateDeleting, + "failed": DevToolPortalProvisioningStateFailed, + "succeeded": DevToolPortalProvisioningStateSucceeded, + "updating": DevToolPortalProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DevToolPortalProvisioningState(input) + return &out, nil +} + +type EurekaServerEnabledState string + +const ( + EurekaServerEnabledStateDisabled EurekaServerEnabledState = "Disabled" + EurekaServerEnabledStateEnabled EurekaServerEnabledState = "Enabled" +) + +func PossibleValuesForEurekaServerEnabledState() []string { + return []string{ + string(EurekaServerEnabledStateDisabled), + string(EurekaServerEnabledStateEnabled), + } +} + +func (s *EurekaServerEnabledState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEurekaServerEnabledState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEurekaServerEnabledState(input string) (*EurekaServerEnabledState, error) { + vals := map[string]EurekaServerEnabledState{ + "disabled": EurekaServerEnabledStateDisabled, + "enabled": EurekaServerEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EurekaServerEnabledState(input) + return &out, nil +} + +type EurekaServerState string + +const ( + EurekaServerStateCanceled EurekaServerState = "Canceled" + EurekaServerStateFailed EurekaServerState = "Failed" + EurekaServerStateSucceeded EurekaServerState = "Succeeded" + EurekaServerStateUpdating EurekaServerState = "Updating" +) + +func PossibleValuesForEurekaServerState() []string { + return []string{ + string(EurekaServerStateCanceled), + string(EurekaServerStateFailed), + string(EurekaServerStateSucceeded), + string(EurekaServerStateUpdating), + } +} + +func (s *EurekaServerState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEurekaServerState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEurekaServerState(input string) (*EurekaServerState, error) { + vals := map[string]EurekaServerState{ + "canceled": EurekaServerStateCanceled, + "failed": EurekaServerStateFailed, + "succeeded": EurekaServerStateSucceeded, + "updating": EurekaServerStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EurekaServerState(input) + return &out, nil +} + +type Frequency string + +const ( + FrequencyWeekly Frequency = "Weekly" +) + +func PossibleValuesForFrequency() []string { + return []string{ + string(FrequencyWeekly), + } +} + +func (s *Frequency) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFrequency(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseFrequency(input string) (*Frequency, error) { + vals := map[string]Frequency{ + "weekly": FrequencyWeekly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Frequency(input) + return &out, nil +} + +type GatewayCertificateVerification string + +const ( + GatewayCertificateVerificationDisabled GatewayCertificateVerification = "Disabled" + GatewayCertificateVerificationEnabled GatewayCertificateVerification = "Enabled" +) + +func PossibleValuesForGatewayCertificateVerification() []string { + return []string{ + string(GatewayCertificateVerificationDisabled), + string(GatewayCertificateVerificationEnabled), + } +} + +func (s *GatewayCertificateVerification) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGatewayCertificateVerification(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGatewayCertificateVerification(input string) (*GatewayCertificateVerification, error) { + vals := map[string]GatewayCertificateVerification{ + "disabled": GatewayCertificateVerificationDisabled, + "enabled": GatewayCertificateVerificationEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GatewayCertificateVerification(input) + return &out, nil +} + +type GatewayProvisioningState string + +const ( + GatewayProvisioningStateCreating GatewayProvisioningState = "Creating" + GatewayProvisioningStateDeleting GatewayProvisioningState = "Deleting" + GatewayProvisioningStateFailed GatewayProvisioningState = "Failed" + GatewayProvisioningStateSucceeded GatewayProvisioningState = "Succeeded" + GatewayProvisioningStateUpdating GatewayProvisioningState = "Updating" +) + +func PossibleValuesForGatewayProvisioningState() []string { + return []string{ + string(GatewayProvisioningStateCreating), + string(GatewayProvisioningStateDeleting), + string(GatewayProvisioningStateFailed), + string(GatewayProvisioningStateSucceeded), + string(GatewayProvisioningStateUpdating), + } +} + +func (s *GatewayProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGatewayProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGatewayProvisioningState(input string) (*GatewayProvisioningState, error) { + vals := map[string]GatewayProvisioningState{ + "creating": GatewayProvisioningStateCreating, + "deleting": GatewayProvisioningStateDeleting, + "failed": GatewayProvisioningStateFailed, + "succeeded": GatewayProvisioningStateSucceeded, + "updating": GatewayProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GatewayProvisioningState(input) + return &out, nil +} + +type GatewayRouteConfigProtocol string + +const ( + GatewayRouteConfigProtocolHTTP GatewayRouteConfigProtocol = "HTTP" + GatewayRouteConfigProtocolHTTPS GatewayRouteConfigProtocol = "HTTPS" +) + +func PossibleValuesForGatewayRouteConfigProtocol() []string { + return []string{ + string(GatewayRouteConfigProtocolHTTP), + string(GatewayRouteConfigProtocolHTTPS), + } +} + +func (s *GatewayRouteConfigProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGatewayRouteConfigProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGatewayRouteConfigProtocol(input string) (*GatewayRouteConfigProtocol, error) { + vals := map[string]GatewayRouteConfigProtocol{ + "http": GatewayRouteConfigProtocolHTTP, + "https": GatewayRouteConfigProtocolHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GatewayRouteConfigProtocol(input) + return &out, nil +} + +type GitImplementation string + +const ( + GitImplementationGoNegativegit GitImplementation = "go-git" + GitImplementationLibgitTwo GitImplementation = "libgit2" +) + +func PossibleValuesForGitImplementation() []string { + return []string{ + string(GitImplementationGoNegativegit), + string(GitImplementationLibgitTwo), + } +} + +func (s *GitImplementation) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGitImplementation(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGitImplementation(input string) (*GitImplementation, error) { + vals := map[string]GitImplementation{ + "go-git": GitImplementationGoNegativegit, + "libgit2": GitImplementationLibgitTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GitImplementation(input) + return &out, nil +} + +type HTTPSchemeType string + +const ( + HTTPSchemeTypeHTTP HTTPSchemeType = "HTTP" + HTTPSchemeTypeHTTPS HTTPSchemeType = "HTTPS" +) + +func PossibleValuesForHTTPSchemeType() []string { + return []string{ + string(HTTPSchemeTypeHTTP), + string(HTTPSchemeTypeHTTPS), + } +} + +func (s *HTTPSchemeType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPSchemeType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHTTPSchemeType(input string) (*HTTPSchemeType, error) { + vals := map[string]HTTPSchemeType{ + "http": HTTPSchemeTypeHTTP, + "https": HTTPSchemeTypeHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HTTPSchemeType(input) + return &out, nil +} + +type JobExecutionRunningState string + +const ( + JobExecutionRunningStateCanceled JobExecutionRunningState = "Canceled" + JobExecutionRunningStateCompleted JobExecutionRunningState = "Completed" + JobExecutionRunningStateFailed JobExecutionRunningState = "Failed" + JobExecutionRunningStatePending JobExecutionRunningState = "Pending" + JobExecutionRunningStateRunning JobExecutionRunningState = "Running" +) + +func PossibleValuesForJobExecutionRunningState() []string { + return []string{ + string(JobExecutionRunningStateCanceled), + string(JobExecutionRunningStateCompleted), + string(JobExecutionRunningStateFailed), + string(JobExecutionRunningStatePending), + string(JobExecutionRunningStateRunning), + } +} + +func (s *JobExecutionRunningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseJobExecutionRunningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseJobExecutionRunningState(input string) (*JobExecutionRunningState, error) { + vals := map[string]JobExecutionRunningState{ + "canceled": JobExecutionRunningStateCanceled, + "completed": JobExecutionRunningStateCompleted, + "failed": JobExecutionRunningStateFailed, + "pending": JobExecutionRunningStatePending, + "running": JobExecutionRunningStateRunning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JobExecutionRunningState(input) + return &out, nil +} + +type JobResourceProvisioningState string + +const ( + JobResourceProvisioningStateCanceled JobResourceProvisioningState = "Canceled" + JobResourceProvisioningStateCreating JobResourceProvisioningState = "Creating" + JobResourceProvisioningStateDeleting JobResourceProvisioningState = "Deleting" + JobResourceProvisioningStateFailed JobResourceProvisioningState = "Failed" + JobResourceProvisioningStateSucceeded JobResourceProvisioningState = "Succeeded" + JobResourceProvisioningStateUpdating JobResourceProvisioningState = "Updating" +) + +func PossibleValuesForJobResourceProvisioningState() []string { + return []string{ + string(JobResourceProvisioningStateCanceled), + string(JobResourceProvisioningStateCreating), + string(JobResourceProvisioningStateDeleting), + string(JobResourceProvisioningStateFailed), + string(JobResourceProvisioningStateSucceeded), + string(JobResourceProvisioningStateUpdating), + } +} + +func (s *JobResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseJobResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseJobResourceProvisioningState(input string) (*JobResourceProvisioningState, error) { + vals := map[string]JobResourceProvisioningState{ + "canceled": JobResourceProvisioningStateCanceled, + "creating": JobResourceProvisioningStateCreating, + "deleting": JobResourceProvisioningStateDeleting, + "failed": JobResourceProvisioningStateFailed, + "succeeded": JobResourceProvisioningStateSucceeded, + "updating": JobResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JobResourceProvisioningState(input) + return &out, nil +} + +type KPackBuildStageProvisioningState string + +const ( + KPackBuildStageProvisioningStateFailed KPackBuildStageProvisioningState = "Failed" + KPackBuildStageProvisioningStateNotStarted KPackBuildStageProvisioningState = "NotStarted" + KPackBuildStageProvisioningStateRunning KPackBuildStageProvisioningState = "Running" + KPackBuildStageProvisioningStateSucceeded KPackBuildStageProvisioningState = "Succeeded" +) + +func PossibleValuesForKPackBuildStageProvisioningState() []string { + return []string{ + string(KPackBuildStageProvisioningStateFailed), + string(KPackBuildStageProvisioningStateNotStarted), + string(KPackBuildStageProvisioningStateRunning), + string(KPackBuildStageProvisioningStateSucceeded), + } +} + +func (s *KPackBuildStageProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKPackBuildStageProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseKPackBuildStageProvisioningState(input string) (*KPackBuildStageProvisioningState, error) { + vals := map[string]KPackBuildStageProvisioningState{ + "failed": KPackBuildStageProvisioningStateFailed, + "notstarted": KPackBuildStageProvisioningStateNotStarted, + "running": KPackBuildStageProvisioningStateRunning, + "succeeded": KPackBuildStageProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KPackBuildStageProvisioningState(input) + return &out, nil +} + +type KeyVaultCertificateAutoSync string + +const ( + KeyVaultCertificateAutoSyncDisabled KeyVaultCertificateAutoSync = "Disabled" + KeyVaultCertificateAutoSyncEnabled KeyVaultCertificateAutoSync = "Enabled" +) + +func PossibleValuesForKeyVaultCertificateAutoSync() []string { + return []string{ + string(KeyVaultCertificateAutoSyncDisabled), + string(KeyVaultCertificateAutoSyncEnabled), + } +} + +func (s *KeyVaultCertificateAutoSync) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyVaultCertificateAutoSync(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseKeyVaultCertificateAutoSync(input string) (*KeyVaultCertificateAutoSync, error) { + vals := map[string]KeyVaultCertificateAutoSync{ + "disabled": KeyVaultCertificateAutoSyncDisabled, + "enabled": KeyVaultCertificateAutoSyncEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyVaultCertificateAutoSync(input) + return &out, nil +} + +type MonitoringSettingState string + +const ( + MonitoringSettingStateFailed MonitoringSettingState = "Failed" + MonitoringSettingStateNotAvailable MonitoringSettingState = "NotAvailable" + MonitoringSettingStateSucceeded MonitoringSettingState = "Succeeded" + MonitoringSettingStateUpdating MonitoringSettingState = "Updating" +) + +func PossibleValuesForMonitoringSettingState() []string { + return []string{ + string(MonitoringSettingStateFailed), + string(MonitoringSettingStateNotAvailable), + string(MonitoringSettingStateSucceeded), + string(MonitoringSettingStateUpdating), + } +} + +func (s *MonitoringSettingState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMonitoringSettingState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMonitoringSettingState(input string) (*MonitoringSettingState, error) { + vals := map[string]MonitoringSettingState{ + "failed": MonitoringSettingStateFailed, + "notavailable": MonitoringSettingStateNotAvailable, + "succeeded": MonitoringSettingStateSucceeded, + "updating": MonitoringSettingStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MonitoringSettingState(input) + return &out, nil +} + +type PowerState string + +const ( + PowerStateRunning PowerState = "Running" + PowerStateStopped PowerState = "Stopped" +) + +func PossibleValuesForPowerState() []string { + return []string{ + string(PowerStateRunning), + string(PowerStateStopped), + } +} + +func (s *PowerState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePowerState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePowerState(input string) (*PowerState, error) { + vals := map[string]PowerState{ + "running": PowerStateRunning, + "stopped": PowerStateStopped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PowerState(input) + return &out, nil +} + +type PredefinedAcceleratorProvisioningState string + +const ( + PredefinedAcceleratorProvisioningStateCanceled PredefinedAcceleratorProvisioningState = "Canceled" + PredefinedAcceleratorProvisioningStateCreating PredefinedAcceleratorProvisioningState = "Creating" + PredefinedAcceleratorProvisioningStateFailed PredefinedAcceleratorProvisioningState = "Failed" + PredefinedAcceleratorProvisioningStateSucceeded PredefinedAcceleratorProvisioningState = "Succeeded" + PredefinedAcceleratorProvisioningStateUpdating PredefinedAcceleratorProvisioningState = "Updating" +) + +func PossibleValuesForPredefinedAcceleratorProvisioningState() []string { + return []string{ + string(PredefinedAcceleratorProvisioningStateCanceled), + string(PredefinedAcceleratorProvisioningStateCreating), + string(PredefinedAcceleratorProvisioningStateFailed), + string(PredefinedAcceleratorProvisioningStateSucceeded), + string(PredefinedAcceleratorProvisioningStateUpdating), + } +} + +func (s *PredefinedAcceleratorProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePredefinedAcceleratorProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePredefinedAcceleratorProvisioningState(input string) (*PredefinedAcceleratorProvisioningState, error) { + vals := map[string]PredefinedAcceleratorProvisioningState{ + "canceled": PredefinedAcceleratorProvisioningStateCanceled, + "creating": PredefinedAcceleratorProvisioningStateCreating, + "failed": PredefinedAcceleratorProvisioningStateFailed, + "succeeded": PredefinedAcceleratorProvisioningStateSucceeded, + "updating": PredefinedAcceleratorProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PredefinedAcceleratorProvisioningState(input) + return &out, nil +} + +type PredefinedAcceleratorState string + +const ( + PredefinedAcceleratorStateDisabled PredefinedAcceleratorState = "Disabled" + PredefinedAcceleratorStateEnabled PredefinedAcceleratorState = "Enabled" +) + +func PossibleValuesForPredefinedAcceleratorState() []string { + return []string{ + string(PredefinedAcceleratorStateDisabled), + string(PredefinedAcceleratorStateEnabled), + } +} + +func (s *PredefinedAcceleratorState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePredefinedAcceleratorState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePredefinedAcceleratorState(input string) (*PredefinedAcceleratorState, error) { + vals := map[string]PredefinedAcceleratorState{ + "disabled": PredefinedAcceleratorStateDisabled, + "enabled": PredefinedAcceleratorStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PredefinedAcceleratorState(input) + return &out, nil +} + +type PrivateStorageAccess string + +const ( + PrivateStorageAccessDisabled PrivateStorageAccess = "Disabled" + PrivateStorageAccessEnabled PrivateStorageAccess = "Enabled" +) + +func PossibleValuesForPrivateStorageAccess() []string { + return []string{ + string(PrivateStorageAccessDisabled), + string(PrivateStorageAccessEnabled), + } +} + +func (s *PrivateStorageAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateStorageAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateStorageAccess(input string) (*PrivateStorageAccess, error) { + vals := map[string]PrivateStorageAccess{ + "disabled": PrivateStorageAccessDisabled, + "enabled": PrivateStorageAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateStorageAccess(input) + return &out, nil +} + +type ProbeActionType string + +const ( + ProbeActionTypeExecAction ProbeActionType = "ExecAction" + ProbeActionTypeHTTPGetAction ProbeActionType = "HTTPGetAction" + ProbeActionTypeTCPSocketAction ProbeActionType = "TCPSocketAction" +) + +func PossibleValuesForProbeActionType() []string { + return []string{ + string(ProbeActionTypeExecAction), + string(ProbeActionTypeHTTPGetAction), + string(ProbeActionTypeTCPSocketAction), + } +} + +func (s *ProbeActionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProbeActionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProbeActionType(input string) (*ProbeActionType, error) { + vals := map[string]ProbeActionType{ + "execaction": ProbeActionTypeExecAction, + "httpgetaction": ProbeActionTypeHTTPGetAction, + "tcpsocketaction": ProbeActionTypeTCPSocketAction, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProbeActionType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" + ProvisioningStateMoved ProvisioningState = "Moved" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateStarting ProvisioningState = "Starting" + ProvisioningStateStopping ProvisioningState = "Stopping" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoveFailed), + string(ProvisioningStateMoved), + string(ProvisioningStateMoving), + string(ProvisioningStateStarting), + string(ProvisioningStateStopping), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "movefailed": ProvisioningStateMoveFailed, + "moved": ProvisioningStateMoved, + "moving": ProvisioningStateMoving, + "starting": ProvisioningStateStarting, + "stopping": ProvisioningStateStopping, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ResourceSkuRestrictionsReasonCode string + +const ( + ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + ResourceSkuRestrictionsReasonCodeQuotaId ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +func PossibleValuesForResourceSkuRestrictionsReasonCode() []string { + return []string{ + string(ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription), + string(ResourceSkuRestrictionsReasonCodeQuotaId), + } +} + +func (s *ResourceSkuRestrictionsReasonCode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceSkuRestrictionsReasonCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceSkuRestrictionsReasonCode(input string) (*ResourceSkuRestrictionsReasonCode, error) { + vals := map[string]ResourceSkuRestrictionsReasonCode{ + "notavailableforsubscription": ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription, + "quotaid": ResourceSkuRestrictionsReasonCodeQuotaId, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceSkuRestrictionsReasonCode(input) + return &out, nil +} + +type ResourceSkuRestrictionsType string + +const ( + ResourceSkuRestrictionsTypeLocation ResourceSkuRestrictionsType = "Location" + ResourceSkuRestrictionsTypeZone ResourceSkuRestrictionsType = "Zone" +) + +func PossibleValuesForResourceSkuRestrictionsType() []string { + return []string{ + string(ResourceSkuRestrictionsTypeLocation), + string(ResourceSkuRestrictionsTypeZone), + } +} + +func (s *ResourceSkuRestrictionsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceSkuRestrictionsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceSkuRestrictionsType(input string) (*ResourceSkuRestrictionsType, error) { + vals := map[string]ResourceSkuRestrictionsType{ + "location": ResourceSkuRestrictionsTypeLocation, + "zone": ResourceSkuRestrictionsTypeZone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceSkuRestrictionsType(input) + return &out, nil +} + +type ServiceRegistryProvisioningState string + +const ( + ServiceRegistryProvisioningStateCreating ServiceRegistryProvisioningState = "Creating" + ServiceRegistryProvisioningStateDeleting ServiceRegistryProvisioningState = "Deleting" + ServiceRegistryProvisioningStateFailed ServiceRegistryProvisioningState = "Failed" + ServiceRegistryProvisioningStateSucceeded ServiceRegistryProvisioningState = "Succeeded" + ServiceRegistryProvisioningStateUpdating ServiceRegistryProvisioningState = "Updating" +) + +func PossibleValuesForServiceRegistryProvisioningState() []string { + return []string{ + string(ServiceRegistryProvisioningStateCreating), + string(ServiceRegistryProvisioningStateDeleting), + string(ServiceRegistryProvisioningStateFailed), + string(ServiceRegistryProvisioningStateSucceeded), + string(ServiceRegistryProvisioningStateUpdating), + } +} + +func (s *ServiceRegistryProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServiceRegistryProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServiceRegistryProvisioningState(input string) (*ServiceRegistryProvisioningState, error) { + vals := map[string]ServiceRegistryProvisioningState{ + "creating": ServiceRegistryProvisioningStateCreating, + "deleting": ServiceRegistryProvisioningStateDeleting, + "failed": ServiceRegistryProvisioningStateFailed, + "succeeded": ServiceRegistryProvisioningStateSucceeded, + "updating": ServiceRegistryProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceRegistryProvisioningState(input) + return &out, nil +} + +type SessionAffinity string + +const ( + SessionAffinityCookie SessionAffinity = "Cookie" + SessionAffinityNone SessionAffinity = "None" +) + +func PossibleValuesForSessionAffinity() []string { + return []string{ + string(SessionAffinityCookie), + string(SessionAffinityNone), + } +} + +func (s *SessionAffinity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSessionAffinity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSessionAffinity(input string) (*SessionAffinity, error) { + vals := map[string]SessionAffinity{ + "cookie": SessionAffinityCookie, + "none": SessionAffinityNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SessionAffinity(input) + return &out, nil +} + +type SkuScaleType string + +const ( + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + SkuScaleTypeManual SkuScaleType = "Manual" + SkuScaleTypeNone SkuScaleType = "None" +) + +func PossibleValuesForSkuScaleType() []string { + return []string{ + string(SkuScaleTypeAutomatic), + string(SkuScaleTypeManual), + string(SkuScaleTypeNone), + } +} + +func (s *SkuScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuScaleType(input string) (*SkuScaleType, error) { + vals := map[string]SkuScaleType{ + "automatic": SkuScaleTypeAutomatic, + "manual": SkuScaleTypeManual, + "none": SkuScaleTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuScaleType(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeStorageAccount StorageType = "StorageAccount" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeStorageAccount), + } +} + +func (s *StorageType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "storageaccount": StorageTypeStorageAccount, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type SupportedRuntimePlatform string + +const ( + SupportedRuntimePlatformJava SupportedRuntimePlatform = "Java" + SupportedRuntimePlatformPointNETCore SupportedRuntimePlatform = ".NET Core" +) + +func PossibleValuesForSupportedRuntimePlatform() []string { + return []string{ + string(SupportedRuntimePlatformJava), + string(SupportedRuntimePlatformPointNETCore), + } +} + +func (s *SupportedRuntimePlatform) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSupportedRuntimePlatform(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSupportedRuntimePlatform(input string) (*SupportedRuntimePlatform, error) { + vals := map[string]SupportedRuntimePlatform{ + "java": SupportedRuntimePlatformJava, + ".net core": SupportedRuntimePlatformPointNETCore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SupportedRuntimePlatform(input) + return &out, nil +} + +type SupportedRuntimeValue string + +const ( + SupportedRuntimeValueJavaEight SupportedRuntimeValue = "Java_8" + SupportedRuntimeValueJavaOneOne SupportedRuntimeValue = "Java_11" + SupportedRuntimeValueJavaOneSeven SupportedRuntimeValue = "Java_17" + SupportedRuntimeValueJavaTwoOne SupportedRuntimeValue = "Java_21" + SupportedRuntimeValueNetCoreThreeOne SupportedRuntimeValue = "NetCore_31" +) + +func PossibleValuesForSupportedRuntimeValue() []string { + return []string{ + string(SupportedRuntimeValueJavaEight), + string(SupportedRuntimeValueJavaOneOne), + string(SupportedRuntimeValueJavaOneSeven), + string(SupportedRuntimeValueJavaTwoOne), + string(SupportedRuntimeValueNetCoreThreeOne), + } +} + +func (s *SupportedRuntimeValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSupportedRuntimeValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSupportedRuntimeValue(input string) (*SupportedRuntimeValue, error) { + vals := map[string]SupportedRuntimeValue{ + "java_8": SupportedRuntimeValueJavaEight, + "java_11": SupportedRuntimeValueJavaOneOne, + "java_17": SupportedRuntimeValueJavaOneSeven, + "java_21": SupportedRuntimeValueJavaTwoOne, + "netcore_31": SupportedRuntimeValueNetCoreThreeOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SupportedRuntimeValue(input) + return &out, nil +} + +type TestEndpointAuthState string + +const ( + TestEndpointAuthStateDisabled TestEndpointAuthState = "Disabled" + TestEndpointAuthStateEnabled TestEndpointAuthState = "Enabled" +) + +func PossibleValuesForTestEndpointAuthState() []string { + return []string{ + string(TestEndpointAuthStateDisabled), + string(TestEndpointAuthStateEnabled), + } +} + +func (s *TestEndpointAuthState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTestEndpointAuthState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTestEndpointAuthState(input string) (*TestEndpointAuthState, error) { + vals := map[string]TestEndpointAuthState{ + "disabled": TestEndpointAuthStateDisabled, + "enabled": TestEndpointAuthStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TestEndpointAuthState(input) + return &out, nil +} + +type TestKeyType string + +const ( + TestKeyTypePrimary TestKeyType = "Primary" + TestKeyTypeSecondary TestKeyType = "Secondary" +) + +func PossibleValuesForTestKeyType() []string { + return []string{ + string(TestKeyTypePrimary), + string(TestKeyTypeSecondary), + } +} + +func (s *TestKeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTestKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTestKeyType(input string) (*TestKeyType, error) { + vals := map[string]TestKeyType{ + "primary": TestKeyTypePrimary, + "secondary": TestKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TestKeyType(input) + return &out, nil +} + +type TrafficDirection string + +const ( + TrafficDirectionInbound TrafficDirection = "Inbound" + TrafficDirectionOutbound TrafficDirection = "Outbound" +) + +func PossibleValuesForTrafficDirection() []string { + return []string{ + string(TrafficDirectionInbound), + string(TrafficDirectionOutbound), + } +} + +func (s *TrafficDirection) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTrafficDirection(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTrafficDirection(input string) (*TrafficDirection, error) { + vals := map[string]TrafficDirection{ + "inbound": TrafficDirectionInbound, + "outbound": TrafficDirectionOutbound, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrafficDirection(input) + return &out, nil +} + +type TriggerType string + +const ( + TriggerTypeManual TriggerType = "Manual" +) + +func PossibleValuesForTriggerType() []string { + return []string{ + string(TriggerTypeManual), + } +} + +func (s *TriggerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTriggerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTriggerType(input string) (*TriggerType, error) { + vals := map[string]TriggerType{ + "manual": TriggerTypeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggerType(input) + return &out, nil +} + +type TriggeredBuildResultProvisioningState string + +const ( + TriggeredBuildResultProvisioningStateBuilding TriggeredBuildResultProvisioningState = "Building" + TriggeredBuildResultProvisioningStateCanceled TriggeredBuildResultProvisioningState = "Canceled" + TriggeredBuildResultProvisioningStateDeleting TriggeredBuildResultProvisioningState = "Deleting" + TriggeredBuildResultProvisioningStateFailed TriggeredBuildResultProvisioningState = "Failed" + TriggeredBuildResultProvisioningStateQueuing TriggeredBuildResultProvisioningState = "Queuing" + TriggeredBuildResultProvisioningStateSucceeded TriggeredBuildResultProvisioningState = "Succeeded" +) + +func PossibleValuesForTriggeredBuildResultProvisioningState() []string { + return []string{ + string(TriggeredBuildResultProvisioningStateBuilding), + string(TriggeredBuildResultProvisioningStateCanceled), + string(TriggeredBuildResultProvisioningStateDeleting), + string(TriggeredBuildResultProvisioningStateFailed), + string(TriggeredBuildResultProvisioningStateQueuing), + string(TriggeredBuildResultProvisioningStateSucceeded), + } +} + +func (s *TriggeredBuildResultProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTriggeredBuildResultProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTriggeredBuildResultProvisioningState(input string) (*TriggeredBuildResultProvisioningState, error) { + vals := map[string]TriggeredBuildResultProvisioningState{ + "building": TriggeredBuildResultProvisioningStateBuilding, + "canceled": TriggeredBuildResultProvisioningStateCanceled, + "deleting": TriggeredBuildResultProvisioningStateDeleting, + "failed": TriggeredBuildResultProvisioningStateFailed, + "queuing": TriggeredBuildResultProvisioningStateQueuing, + "succeeded": TriggeredBuildResultProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggeredBuildResultProvisioningState(input) + return &out, nil +} + +type Type string + +const ( + TypeAzureFileVolume Type = "AzureFileVolume" +) + +func PossibleValuesForType() []string { + return []string{ + string(TypeAzureFileVolume), + } +} + +func (s *Type) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseType(input string) (*Type, error) { + vals := map[string]Type{ + "azurefilevolume": TypeAzureFileVolume, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Type(input) + return &out, nil +} + +type WeekDay string + +const ( + WeekDayFriday WeekDay = "Friday" + WeekDayMonday WeekDay = "Monday" + WeekDaySaturday WeekDay = "Saturday" + WeekDaySunday WeekDay = "Sunday" + WeekDayThursday WeekDay = "Thursday" + WeekDayTuesday WeekDay = "Tuesday" + WeekDayWednesday WeekDay = "Wednesday" +) + +func PossibleValuesForWeekDay() []string { + return []string{ + string(WeekDayFriday), + string(WeekDayMonday), + string(WeekDaySaturday), + string(WeekDaySunday), + string(WeekDayThursday), + string(WeekDayTuesday), + string(WeekDayWednesday), + } +} + +func (s *WeekDay) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWeekDay(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWeekDay(input string) (*WeekDay, error) { + vals := map[string]WeekDay{ + "friday": WeekDayFriday, + "monday": WeekDayMonday, + "saturday": WeekDaySaturday, + "sunday": WeekDaySunday, + "thursday": WeekDayThursday, + "tuesday": WeekDayTuesday, + "wednesday": WeekDayWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WeekDay(input) + return &out, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool.go new file mode 100644 index 00000000000..1fc67a79b7b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&AgentPoolId{}) +} + +var _ resourceids.ResourceId = &AgentPoolId{} + +// AgentPoolId is a struct representing the Resource ID for a Agent Pool +type AgentPoolId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + AgentPoolName string +} + +// NewAgentPoolID returns a new AgentPoolId struct +func NewAgentPoolID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, agentPoolName string) AgentPoolId { + return AgentPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + AgentPoolName: agentPoolName, + } +} + +// ParseAgentPoolID parses 'input' into a AgentPoolId +func ParseAgentPoolID(input string) (*AgentPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(&AgentPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AgentPoolId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAgentPoolIDInsensitively parses 'input' case-insensitively into a AgentPoolId +// note: this method should only be used for API response data and not user input +func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(&AgentPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AgentPoolId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) + } + + return nil +} + +// ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID +func ValidateAgentPoolID(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 := ParseAgentPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Agent Pool ID +func (id AgentPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/agentPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.AgentPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Agent Pool ID +func (id AgentPoolId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticAgentPools", "agentPools", "agentPools"), + resourceids.UserSpecifiedSegment("agentPoolName", "agentPoolName"), + } +} + +// String returns a human-readable description of this Agent Pool ID +func (id AgentPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Agent Pool Name: %q", id.AgentPoolName), + } + return fmt.Sprintf("Agent Pool (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool_test.go new file mode 100644 index 00000000000..242f12f7b3f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_agentpool_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &AgentPoolId{} + +func TestNewAgentPoolID(t *testing.T) { + id := NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "agentPoolName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.AgentPoolName != "agentPoolName" { + t.Fatalf("Expected %q but got %q for Segment 'AgentPoolName'", id.AgentPoolName, "agentPoolName") + } +} + +func TestFormatAgentPoolID(t *testing.T) { + actual := NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "agentPoolName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools/agentPoolName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAgentPoolID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AgentPoolId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools/agentPoolName", + Expected: &AgentPoolId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + AgentPoolName: "agentPoolName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools/agentPoolName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAgentPoolID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.AgentPoolName != v.Expected.AgentPoolName { + t.Fatalf("Expected %q but got %q for AgentPoolName", v.Expected.AgentPoolName, actual.AgentPoolName) + } + + } +} + +func TestParseAgentPoolIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AgentPoolId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/aGeNtPoOlS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools/agentPoolName", + Expected: &AgentPoolId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + AgentPoolName: "agentPoolName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/agentPools/agentPoolName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/aGeNtPoOlS/aGeNtPoOlNaMe", + Expected: &AgentPoolId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + AgentPoolName: "aGeNtPoOlNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/aGeNtPoOlS/aGeNtPoOlNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAgentPoolIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.AgentPoolName != v.Expected.AgentPoolName { + t.Fatalf("Expected %q but got %q for AgentPoolName", v.Expected.AgentPoolName, actual.AgentPoolName) + } + + } +} + +func TestSegmentsForAgentPoolId(t *testing.T) { + segments := AgentPoolId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AgentPoolId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal.go new file mode 100644 index 00000000000..09a2ce96867 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ApiPortalId{}) +} + +var _ resourceids.ResourceId = &ApiPortalId{} + +// ApiPortalId is a struct representing the Resource ID for a Api Portal +type ApiPortalId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApiPortalName string +} + +// NewApiPortalID returns a new ApiPortalId struct +func NewApiPortalID(subscriptionId string, resourceGroupName string, springName string, apiPortalName string) ApiPortalId { + return ApiPortalId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApiPortalName: apiPortalName, + } +} + +// ParseApiPortalID parses 'input' into a ApiPortalId +func ParseApiPortalID(input string) (*ApiPortalId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApiPortalId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApiPortalId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApiPortalIDInsensitively parses 'input' case-insensitively into a ApiPortalId +// note: this method should only be used for API response data and not user input +func ParseApiPortalIDInsensitively(input string) (*ApiPortalId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApiPortalId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApiPortalId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiPortalId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApiPortalName, ok = input.Parsed["apiPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", input) + } + + return nil +} + +// ValidateApiPortalID checks that 'input' can be parsed as a Api Portal ID +func ValidateApiPortalID(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 := ParseApiPortalID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Portal ID +func (id ApiPortalId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apiPortals/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApiPortalName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Portal ID +func (id ApiPortalId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApiPortals", "apiPortals", "apiPortals"), + resourceids.UserSpecifiedSegment("apiPortalName", "apiPortalName"), + } +} + +// String returns a human-readable description of this Api Portal ID +func (id ApiPortalId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Api Portal Name: %q", id.ApiPortalName), + } + return fmt.Sprintf("Api Portal (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal_test.go new file mode 100644 index 00000000000..c3d687076cb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportal_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ApiPortalId{} + +func TestNewApiPortalID(t *testing.T) { + id := NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApiPortalName != "apiPortalName" { + t.Fatalf("Expected %q but got %q for Segment 'ApiPortalName'", id.ApiPortalName, "apiPortalName") + } +} + +func TestFormatApiPortalID(t *testing.T) { + actual := NewApiPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseApiPortalID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApiPortalId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName", + Expected: &ApiPortalId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApiPortalName: "apiPortalName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApiPortalID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApiPortalName != v.Expected.ApiPortalName { + t.Fatalf("Expected %q but got %q for ApiPortalName", v.Expected.ApiPortalName, actual.ApiPortalName) + } + + } +} + +func TestParseApiPortalIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApiPortalId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName", + Expected: &ApiPortalId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApiPortalName: "apiPortalName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS/aPiPoRtAlNaMe", + Expected: &ApiPortalId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApiPortalName: "aPiPoRtAlNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS/aPiPoRtAlNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApiPortalIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApiPortalName != v.Expected.ApiPortalName { + t.Fatalf("Expected %q but got %q for ApiPortalName", v.Expected.ApiPortalName, actual.ApiPortalName) + } + + } +} + +func TestSegmentsForApiPortalId(t *testing.T) { + segments := ApiPortalId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ApiPortalId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain.go new file mode 100644 index 00000000000..ea76b134608 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ApiPortalDomainId{}) +} + +var _ resourceids.ResourceId = &ApiPortalDomainId{} + +// ApiPortalDomainId is a struct representing the Resource ID for a Api Portal Domain +type ApiPortalDomainId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApiPortalName string + DomainName string +} + +// NewApiPortalDomainID returns a new ApiPortalDomainId struct +func NewApiPortalDomainID(subscriptionId string, resourceGroupName string, springName string, apiPortalName string, domainName string) ApiPortalDomainId { + return ApiPortalDomainId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApiPortalName: apiPortalName, + DomainName: domainName, + } +} + +// ParseApiPortalDomainID parses 'input' into a ApiPortalDomainId +func ParseApiPortalDomainID(input string) (*ApiPortalDomainId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApiPortalDomainId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApiPortalDomainId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApiPortalDomainIDInsensitively parses 'input' case-insensitively into a ApiPortalDomainId +// note: this method should only be used for API response data and not user input +func ParseApiPortalDomainIDInsensitively(input string) (*ApiPortalDomainId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApiPortalDomainId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApiPortalDomainId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiPortalDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApiPortalName, ok = input.Parsed["apiPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", input) + } + + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) + } + + return nil +} + +// ValidateApiPortalDomainID checks that 'input' can be parsed as a Api Portal Domain ID +func ValidateApiPortalDomainID(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 := ParseApiPortalDomainID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Portal Domain ID +func (id ApiPortalDomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apiPortals/%s/domains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApiPortalName, id.DomainName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Portal Domain ID +func (id ApiPortalDomainId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApiPortals", "apiPortals", "apiPortals"), + resourceids.UserSpecifiedSegment("apiPortalName", "apiPortalName"), + resourceids.StaticSegment("staticDomains", "domains", "domains"), + resourceids.UserSpecifiedSegment("domainName", "domainName"), + } +} + +// String returns a human-readable description of this Api Portal Domain ID +func (id ApiPortalDomainId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Api Portal Name: %q", id.ApiPortalName), + fmt.Sprintf("Domain Name: %q", id.DomainName), + } + return fmt.Sprintf("Api Portal Domain (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain_test.go new file mode 100644 index 00000000000..d5919ec39a3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apiportaldomain_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &ApiPortalDomainId{} + +func TestNewApiPortalDomainID(t *testing.T) { + id := NewApiPortalDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName", "domainName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApiPortalName != "apiPortalName" { + t.Fatalf("Expected %q but got %q for Segment 'ApiPortalName'", id.ApiPortalName, "apiPortalName") + } + + if id.DomainName != "domainName" { + t.Fatalf("Expected %q but got %q for Segment 'DomainName'", id.DomainName, "domainName") + } +} + +func TestFormatApiPortalDomainID(t *testing.T) { + actual := NewApiPortalDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apiPortalName", "domainName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains/domainName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseApiPortalDomainID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApiPortalDomainId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains/domainName", + Expected: &ApiPortalDomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApiPortalName: "apiPortalName", + DomainName: "domainName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains/domainName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApiPortalDomainID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApiPortalName != v.Expected.ApiPortalName { + t.Fatalf("Expected %q but got %q for ApiPortalName", v.Expected.ApiPortalName, actual.ApiPortalName) + } + + if actual.DomainName != v.Expected.DomainName { + t.Fatalf("Expected %q but got %q for DomainName", v.Expected.DomainName, actual.DomainName) + } + + } +} + +func TestParseApiPortalDomainIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApiPortalDomainId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS/aPiPoRtAlNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS/aPiPoRtAlNaMe/dOmAiNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains/domainName", + Expected: &ApiPortalDomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApiPortalName: "apiPortalName", + DomainName: "domainName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apiPortals/apiPortalName/domains/domainName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS/aPiPoRtAlNaMe/dOmAiNs/dOmAiNnAmE", + Expected: &ApiPortalDomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApiPortalName: "aPiPoRtAlNaMe", + DomainName: "dOmAiNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPiPoRtAlS/aPiPoRtAlNaMe/dOmAiNs/dOmAiNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApiPortalDomainIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApiPortalName != v.Expected.ApiPortalName { + t.Fatalf("Expected %q but got %q for ApiPortalName", v.Expected.ApiPortalName, actual.ApiPortalName) + } + + if actual.DomainName != v.Expected.DomainName { + t.Fatalf("Expected %q but got %q for DomainName", v.Expected.DomainName, actual.DomainName) + } + + } +} + +func TestSegmentsForApiPortalDomainId(t *testing.T) { + segments := ApiPortalDomainId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ApiPortalDomainId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm.go new file mode 100644 index 00000000000..f36f8c46dab --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ApmId{}) +} + +var _ resourceids.ResourceId = &ApmId{} + +// ApmId is a struct representing the Resource ID for a Apm +type ApmId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApmName string +} + +// NewApmID returns a new ApmId struct +func NewApmID(subscriptionId string, resourceGroupName string, springName string, apmName string) ApmId { + return ApmId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApmName: apmName, + } +} + +// ParseApmID parses 'input' into a ApmId +func ParseApmID(input string) (*ApmId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApmId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApmId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApmIDInsensitively parses 'input' case-insensitively into a ApmId +// note: this method should only be used for API response data and not user input +func ParseApmIDInsensitively(input string) (*ApmId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApmId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApmId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApmId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApmName, ok = input.Parsed["apmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apmName", input) + } + + return nil +} + +// ValidateApmID checks that 'input' can be parsed as a Apm ID +func ValidateApmID(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 := ParseApmID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Apm ID +func (id ApmId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apms/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApmName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Apm ID +func (id ApmId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApms", "apms", "apms"), + resourceids.UserSpecifiedSegment("apmName", "apmName"), + } +} + +// String returns a human-readable description of this Apm ID +func (id ApmId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Apm Name: %q", id.ApmName), + } + return fmt.Sprintf("Apm (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm_test.go new file mode 100644 index 00000000000..14066e8a544 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_apm_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ApmId{} + +func TestNewApmID(t *testing.T) { + id := NewApmID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apmName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApmName != "apmName" { + t.Fatalf("Expected %q but got %q for Segment 'ApmName'", id.ApmName, "apmName") + } +} + +func TestFormatApmID(t *testing.T) { + actual := NewApmID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "apmName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms/apmName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseApmID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApmId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms/apmName", + Expected: &ApmId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApmName: "apmName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms/apmName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApmID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApmName != v.Expected.ApmName { + t.Fatalf("Expected %q but got %q for ApmName", v.Expected.ApmName, actual.ApmName) + } + + } +} + +func TestParseApmIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApmId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPmS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms/apmName", + Expected: &ApmId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApmName: "apmName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apms/apmName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPmS/aPmNaMe", + Expected: &ApmId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApmName: "aPmNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPmS/aPmNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApmIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApmName != v.Expected.ApmName { + t.Fatalf("Expected %q but got %q for ApmName", v.Expected.ApmName, actual.ApmName) + } + + } +} + +func TestSegmentsForApmId(t *testing.T) { + segments := ApmId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ApmId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_app.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_app.go new file mode 100644 index 00000000000..e2f8ec3beeb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_app.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&AppId{}) +} + +var _ resourceids.ResourceId = &AppId{} + +// AppId is a struct representing the Resource ID for a App +type AppId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + AppName string +} + +// NewAppID returns a new AppId struct +func NewAppID(subscriptionId string, resourceGroupName string, springName string, appName string) AppId { + return AppId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + AppName: appName, + } +} + +// ParseAppID parses 'input' into a AppId +func ParseAppID(input string) (*AppId, error) { + parser := resourceids.NewParserFromResourceIdType(&AppId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AppId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAppIDInsensitively parses 'input' case-insensitively into a AppId +// note: this method should only be used for API response data and not user input +func ParseAppIDInsensitively(input string) (*AppId, error) { + parser := resourceids.NewParserFromResourceIdType(&AppId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AppId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) + } + + return nil +} + +// ValidateAppID checks that 'input' can be parsed as a App ID +func ValidateAppID(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 := ParseAppID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted App ID +func (id AppId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apps/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.AppName) +} + +// Segments returns a slice of Resource ID Segments which comprise this App ID +func (id AppId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApps", "apps", "apps"), + resourceids.UserSpecifiedSegment("appName", "appName"), + } +} + +// String returns a human-readable description of this App ID +func (id AppId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("App Name: %q", id.AppName), + } + return fmt.Sprintf("App (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_app_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_app_test.go new file mode 100644 index 00000000000..ff64ee8038f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_app_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &AppId{} + +func TestNewAppID(t *testing.T) { + id := NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.AppName != "appName" { + t.Fatalf("Expected %q but got %q for Segment 'AppName'", id.AppName, "appName") + } +} + +func TestFormatAppID(t *testing.T) { + actual := NewAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAppID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AppId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Expected: &AppId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAppID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + } +} + +func TestParseAppIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AppId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Expected: &AppId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe", + Expected: &AppId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + AppName: "aPpNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAppIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + } +} + +func TestSegmentsForAppId(t *testing.T) { + segments := AppId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AppId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator.go new file mode 100644 index 00000000000..1be59dab579 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ApplicationAcceleratorId{}) +} + +var _ resourceids.ResourceId = &ApplicationAcceleratorId{} + +// ApplicationAcceleratorId is a struct representing the Resource ID for a Application Accelerator +type ApplicationAcceleratorId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApplicationAcceleratorName string +} + +// NewApplicationAcceleratorID returns a new ApplicationAcceleratorId struct +func NewApplicationAcceleratorID(subscriptionId string, resourceGroupName string, springName string, applicationAcceleratorName string) ApplicationAcceleratorId { + return ApplicationAcceleratorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApplicationAcceleratorName: applicationAcceleratorName, + } +} + +// ParseApplicationAcceleratorID parses 'input' into a ApplicationAcceleratorId +func ParseApplicationAcceleratorID(input string) (*ApplicationAcceleratorId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApplicationAcceleratorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApplicationAcceleratorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApplicationAcceleratorIDInsensitively parses 'input' case-insensitively into a ApplicationAcceleratorId +// note: this method should only be used for API response data and not user input +func ParseApplicationAcceleratorIDInsensitively(input string) (*ApplicationAcceleratorId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApplicationAcceleratorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApplicationAcceleratorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationAcceleratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) + } + + return nil +} + +// ValidateApplicationAcceleratorID checks that 'input' can be parsed as a Application Accelerator ID +func ValidateApplicationAcceleratorID(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 := ParseApplicationAcceleratorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Accelerator ID +func (id ApplicationAcceleratorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/applicationAccelerators/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApplicationAcceleratorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Accelerator ID +func (id ApplicationAcceleratorId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApplicationAccelerators", "applicationAccelerators", "applicationAccelerators"), + resourceids.UserSpecifiedSegment("applicationAcceleratorName", "applicationAcceleratorName"), + } +} + +// String returns a human-readable description of this Application Accelerator ID +func (id ApplicationAcceleratorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Application Accelerator Name: %q", id.ApplicationAcceleratorName), + } + return fmt.Sprintf("Application Accelerator (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator_test.go new file mode 100644 index 00000000000..8e48861280c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationaccelerator_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ApplicationAcceleratorId{} + +func TestNewApplicationAcceleratorID(t *testing.T) { + id := NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApplicationAcceleratorName != "applicationAcceleratorName" { + t.Fatalf("Expected %q but got %q for Segment 'ApplicationAcceleratorName'", id.ApplicationAcceleratorName, "applicationAcceleratorName") + } +} + +func TestFormatApplicationAcceleratorID(t *testing.T) { + actual := NewApplicationAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseApplicationAcceleratorID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApplicationAcceleratorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName", + Expected: &ApplicationAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationAcceleratorName: "applicationAcceleratorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApplicationAcceleratorID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationAcceleratorName != v.Expected.ApplicationAcceleratorName { + t.Fatalf("Expected %q but got %q for ApplicationAcceleratorName", v.Expected.ApplicationAcceleratorName, actual.ApplicationAcceleratorName) + } + + } +} + +func TestParseApplicationAcceleratorIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApplicationAcceleratorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName", + Expected: &ApplicationAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationAcceleratorName: "applicationAcceleratorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE", + Expected: &ApplicationAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApplicationAcceleratorName: "aPpLiCaTiOnAcCeLeRaToRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApplicationAcceleratorIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationAcceleratorName != v.Expected.ApplicationAcceleratorName { + t.Fatalf("Expected %q but got %q for ApplicationAcceleratorName", v.Expected.ApplicationAcceleratorName, actual.ApplicationAcceleratorName) + } + + } +} + +func TestSegmentsForApplicationAcceleratorId(t *testing.T) { + segments := ApplicationAcceleratorId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ApplicationAcceleratorId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview.go new file mode 100644 index 00000000000..1996b1de170 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ApplicationLiveViewId{}) +} + +var _ resourceids.ResourceId = &ApplicationLiveViewId{} + +// ApplicationLiveViewId is a struct representing the Resource ID for a Application Live View +type ApplicationLiveViewId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApplicationLiveViewName string +} + +// NewApplicationLiveViewID returns a new ApplicationLiveViewId struct +func NewApplicationLiveViewID(subscriptionId string, resourceGroupName string, springName string, applicationLiveViewName string) ApplicationLiveViewId { + return ApplicationLiveViewId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApplicationLiveViewName: applicationLiveViewName, + } +} + +// ParseApplicationLiveViewID parses 'input' into a ApplicationLiveViewId +func ParseApplicationLiveViewID(input string) (*ApplicationLiveViewId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApplicationLiveViewId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApplicationLiveViewId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApplicationLiveViewIDInsensitively parses 'input' case-insensitively into a ApplicationLiveViewId +// note: this method should only be used for API response data and not user input +func ParseApplicationLiveViewIDInsensitively(input string) (*ApplicationLiveViewId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApplicationLiveViewId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApplicationLiveViewId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationLiveViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApplicationLiveViewName, ok = input.Parsed["applicationLiveViewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", input) + } + + return nil +} + +// ValidateApplicationLiveViewID checks that 'input' can be parsed as a Application Live View ID +func ValidateApplicationLiveViewID(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 := ParseApplicationLiveViewID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Live View ID +func (id ApplicationLiveViewId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/applicationLiveViews/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApplicationLiveViewName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Live View ID +func (id ApplicationLiveViewId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApplicationLiveViews", "applicationLiveViews", "applicationLiveViews"), + resourceids.UserSpecifiedSegment("applicationLiveViewName", "applicationLiveViewName"), + } +} + +// String returns a human-readable description of this Application Live View ID +func (id ApplicationLiveViewId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Application Live View Name: %q", id.ApplicationLiveViewName), + } + return fmt.Sprintf("Application Live View (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview_test.go new file mode 100644 index 00000000000..45798b4fcf5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_applicationliveview_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ApplicationLiveViewId{} + +func TestNewApplicationLiveViewID(t *testing.T) { + id := NewApplicationLiveViewID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationLiveViewName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApplicationLiveViewName != "applicationLiveViewName" { + t.Fatalf("Expected %q but got %q for Segment 'ApplicationLiveViewName'", id.ApplicationLiveViewName, "applicationLiveViewName") + } +} + +func TestFormatApplicationLiveViewID(t *testing.T) { + actual := NewApplicationLiveViewID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationLiveViewName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews/applicationLiveViewName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseApplicationLiveViewID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApplicationLiveViewId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews/applicationLiveViewName", + Expected: &ApplicationLiveViewId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationLiveViewName: "applicationLiveViewName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews/applicationLiveViewName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApplicationLiveViewID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationLiveViewName != v.Expected.ApplicationLiveViewName { + t.Fatalf("Expected %q but got %q for ApplicationLiveViewName", v.Expected.ApplicationLiveViewName, actual.ApplicationLiveViewName) + } + + } +} + +func TestParseApplicationLiveViewIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ApplicationLiveViewId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnLiVeViEwS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews/applicationLiveViewName", + Expected: &ApplicationLiveViewId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationLiveViewName: "applicationLiveViewName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationLiveViews/applicationLiveViewName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnLiVeViEwS/aPpLiCaTiOnLiVeViEwNaMe", + Expected: &ApplicationLiveViewId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApplicationLiveViewName: "aPpLiCaTiOnLiVeViEwNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnLiVeViEwS/aPpLiCaTiOnLiVeViEwNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseApplicationLiveViewIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationLiveViewName != v.Expected.ApplicationLiveViewName { + t.Fatalf("Expected %q but got %q for ApplicationLiveViewName", v.Expected.ApplicationLiveViewName, actual.ApplicationLiveViewName) + } + + } +} + +func TestSegmentsForApplicationLiveViewId(t *testing.T) { + segments := ApplicationLiveViewId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ApplicationLiveViewId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding.go new file mode 100644 index 00000000000..a9e87b64338 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&BindingId{}) +} + +var _ resourceids.ResourceId = &BindingId{} + +// BindingId is a struct representing the Resource ID for a Binding +type BindingId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + AppName string + BindingName string +} + +// NewBindingID returns a new BindingId struct +func NewBindingID(subscriptionId string, resourceGroupName string, springName string, appName string, bindingName string) BindingId { + return BindingId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + AppName: appName, + BindingName: bindingName, + } +} + +// ParseBindingID parses 'input' into a BindingId +func ParseBindingID(input string) (*BindingId, error) { + parser := resourceids.NewParserFromResourceIdType(&BindingId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BindingId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBindingIDInsensitively parses 'input' case-insensitively into a BindingId +// note: this method should only be used for API response data and not user input +func ParseBindingIDInsensitively(input string) (*BindingId, error) { + parser := resourceids.NewParserFromResourceIdType(&BindingId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BindingId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) + } + + if id.BindingName, ok = input.Parsed["bindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bindingName", input) + } + + return nil +} + +// ValidateBindingID checks that 'input' can be parsed as a Binding ID +func ValidateBindingID(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 := ParseBindingID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Binding ID +func (id BindingId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apps/%s/bindings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.AppName, id.BindingName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Binding ID +func (id BindingId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApps", "apps", "apps"), + resourceids.UserSpecifiedSegment("appName", "appName"), + resourceids.StaticSegment("staticBindings", "bindings", "bindings"), + resourceids.UserSpecifiedSegment("bindingName", "bindingName"), + } +} + +// String returns a human-readable description of this Binding ID +func (id BindingId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("App Name: %q", id.AppName), + fmt.Sprintf("Binding Name: %q", id.BindingName), + } + return fmt.Sprintf("Binding (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding_test.go new file mode 100644 index 00000000000..34a7ef46b53 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_binding_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &BindingId{} + +func TestNewBindingID(t *testing.T) { + id := NewBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "bindingName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.AppName != "appName" { + t.Fatalf("Expected %q but got %q for Segment 'AppName'", id.AppName, "appName") + } + + if id.BindingName != "bindingName" { + t.Fatalf("Expected %q but got %q for Segment 'BindingName'", id.BindingName, "bindingName") + } +} + +func TestFormatBindingID(t *testing.T) { + actual := NewBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "bindingName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings/bindingName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseBindingID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BindingId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings/bindingName", + Expected: &BindingId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + BindingName: "bindingName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings/bindingName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBindingID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + if actual.BindingName != v.Expected.BindingName { + t.Fatalf("Expected %q but got %q for BindingName", v.Expected.BindingName, actual.BindingName) + } + + } +} + +func TestParseBindingIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BindingId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/bInDiNgS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings/bindingName", + Expected: &BindingId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + BindingName: "bindingName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/bindings/bindingName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/bInDiNgS/bInDiNgNaMe", + Expected: &BindingId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + AppName: "aPpNaMe", + BindingName: "bInDiNgNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/bInDiNgS/bInDiNgNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBindingIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + if actual.BindingName != v.Expected.BindingName { + t.Fatalf("Expected %q but got %q for BindingName", v.Expected.BindingName, actual.BindingName) + } + + } +} + +func TestSegmentsForBindingId(t *testing.T) { + segments := BindingId{}.Segments() + if len(segments) == 0 { + t.Fatalf("BindingId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_build.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_build.go new file mode 100644 index 00000000000..599ed75936a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_build.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&BuildId{}) +} + +var _ resourceids.ResourceId = &BuildId{} + +// BuildId is a struct representing the Resource ID for a Build +type BuildId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + BuildName string +} + +// NewBuildID returns a new BuildId struct +func NewBuildID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, buildName string) BuildId { + return BuildId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + BuildName: buildName, + } +} + +// ParseBuildID parses 'input' into a BuildId +func ParseBuildID(input string) (*BuildId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuildId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuildId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBuildIDInsensitively parses 'input' case-insensitively into a BuildId +// note: this method should only be used for API response data and not user input +func ParseBuildIDInsensitively(input string) (*BuildId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuildId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuildId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) + } + + return nil +} + +// ValidateBuildID checks that 'input' can be parsed as a Build ID +func ValidateBuildID(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 := ParseBuildID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Build ID +func (id BuildId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/builds/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.BuildName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Build ID +func (id BuildId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticBuilds", "builds", "builds"), + resourceids.UserSpecifiedSegment("buildName", "buildName"), + } +} + +// String returns a human-readable description of this Build ID +func (id BuildId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Build Name: %q", id.BuildName), + } + return fmt.Sprintf("Build (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_build_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_build_test.go new file mode 100644 index 00000000000..8ba78207a5c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_build_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &BuildId{} + +func TestNewBuildID(t *testing.T) { + id := NewBuildID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.BuildName != "buildName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildName'", id.BuildName, "buildName") + } +} + +func TestFormatBuildID(t *testing.T) { + actual := NewBuildID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseBuildID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuildId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName", + Expected: &BuildId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuildName: "buildName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuildID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuildName != v.Expected.BuildName { + t.Fatalf("Expected %q but got %q for BuildName", v.Expected.BuildName, actual.BuildName) + } + + } +} + +func TestParseBuildIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuildId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName", + Expected: &BuildId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuildName: "buildName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS/bUiLdNaMe", + Expected: &BuildId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + BuildName: "bUiLdNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS/bUiLdNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuildIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuildName != v.Expected.BuildName { + t.Fatalf("Expected %q but got %q for BuildName", v.Expected.BuildName, actual.BuildName) + } + + } +} + +func TestSegmentsForBuildId(t *testing.T) { + segments := BuildId{}.Segments() + if len(segments) == 0 { + t.Fatalf("BuildId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder.go new file mode 100644 index 00000000000..68e6872f7f5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&BuilderId{}) +} + +var _ resourceids.ResourceId = &BuilderId{} + +// BuilderId is a struct representing the Resource ID for a Builder +type BuilderId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + BuilderName string +} + +// NewBuilderID returns a new BuilderId struct +func NewBuilderID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, builderName string) BuilderId { + return BuilderId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + BuilderName: builderName, + } +} + +// ParseBuilderID parses 'input' into a BuilderId +func ParseBuilderID(input string) (*BuilderId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuilderId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuilderId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBuilderIDInsensitively parses 'input' case-insensitively into a BuilderId +// note: this method should only be used for API response data and not user input +func ParseBuilderIDInsensitively(input string) (*BuilderId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuilderId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuilderId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuilderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.BuilderName, ok = input.Parsed["builderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builderName", input) + } + + return nil +} + +// ValidateBuilderID checks that 'input' can be parsed as a Builder ID +func ValidateBuilderID(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 := ParseBuilderID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Builder ID +func (id BuilderId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/builders/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.BuilderName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Builder ID +func (id BuilderId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticBuilders", "builders", "builders"), + resourceids.UserSpecifiedSegment("builderName", "builderName"), + } +} + +// String returns a human-readable description of this Builder ID +func (id BuilderId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Builder Name: %q", id.BuilderName), + } + return fmt.Sprintf("Builder (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder_test.go new file mode 100644 index 00000000000..1c7f447290f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_builder_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &BuilderId{} + +func TestNewBuilderID(t *testing.T) { + id := NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.BuilderName != "builderName" { + t.Fatalf("Expected %q but got %q for Segment 'BuilderName'", id.BuilderName, "builderName") + } +} + +func TestFormatBuilderID(t *testing.T) { + actual := NewBuilderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseBuilderID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuilderId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName", + Expected: &BuilderId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuilderName: "builderName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuilderID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuilderName != v.Expected.BuilderName { + t.Fatalf("Expected %q but got %q for BuilderName", v.Expected.BuilderName, actual.BuilderName) + } + + } +} + +func TestParseBuilderIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuilderId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName", + Expected: &BuilderId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuilderName: "builderName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS/bUiLdErNaMe", + Expected: &BuilderId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + BuilderName: "bUiLdErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS/bUiLdErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuilderIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuilderName != v.Expected.BuilderName { + t.Fatalf("Expected %q but got %q for BuilderName", v.Expected.BuilderName, actual.BuilderName) + } + + } +} + +func TestSegmentsForBuilderId(t *testing.T) { + segments := BuilderId{}.Segments() + if len(segments) == 0 { + t.Fatalf("BuilderId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding.go new file mode 100644 index 00000000000..844f9cdf390 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding.go @@ -0,0 +1,157 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&BuildPackBindingId{}) +} + +var _ resourceids.ResourceId = &BuildPackBindingId{} + +// BuildPackBindingId is a struct representing the Resource ID for a Build Pack Binding +type BuildPackBindingId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + BuilderName string + BuildPackBindingName string +} + +// NewBuildPackBindingID returns a new BuildPackBindingId struct +func NewBuildPackBindingID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, builderName string, buildPackBindingName string) BuildPackBindingId { + return BuildPackBindingId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + BuilderName: builderName, + BuildPackBindingName: buildPackBindingName, + } +} + +// ParseBuildPackBindingID parses 'input' into a BuildPackBindingId +func ParseBuildPackBindingID(input string) (*BuildPackBindingId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuildPackBindingId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuildPackBindingId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBuildPackBindingIDInsensitively parses 'input' case-insensitively into a BuildPackBindingId +// note: this method should only be used for API response data and not user input +func ParseBuildPackBindingIDInsensitively(input string) (*BuildPackBindingId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuildPackBindingId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuildPackBindingId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildPackBindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.BuilderName, ok = input.Parsed["builderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builderName", input) + } + + if id.BuildPackBindingName, ok = input.Parsed["buildPackBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", input) + } + + return nil +} + +// ValidateBuildPackBindingID checks that 'input' can be parsed as a Build Pack Binding ID +func ValidateBuildPackBindingID(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 := ParseBuildPackBindingID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Build Pack Binding ID +func (id BuildPackBindingId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/builders/%s/buildPackBindings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.BuilderName, id.BuildPackBindingName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Build Pack Binding ID +func (id BuildPackBindingId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticBuilders", "builders", "builders"), + resourceids.UserSpecifiedSegment("builderName", "builderName"), + resourceids.StaticSegment("staticBuildPackBindings", "buildPackBindings", "buildPackBindings"), + resourceids.UserSpecifiedSegment("buildPackBindingName", "buildPackBindingName"), + } +} + +// String returns a human-readable description of this Build Pack Binding ID +func (id BuildPackBindingId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Builder Name: %q", id.BuilderName), + fmt.Sprintf("Build Pack Binding Name: %q", id.BuildPackBindingName), + } + return fmt.Sprintf("Build Pack Binding (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding_test.go new file mode 100644 index 00000000000..1ea68061a43 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildpackbinding_test.go @@ -0,0 +1,417 @@ +package appplatform + +import ( + "testing" + + "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 = &BuildPackBindingId{} + +func TestNewBuildPackBindingID(t *testing.T) { + id := NewBuildPackBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName", "buildPackBindingName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.BuilderName != "builderName" { + t.Fatalf("Expected %q but got %q for Segment 'BuilderName'", id.BuilderName, "builderName") + } + + if id.BuildPackBindingName != "buildPackBindingName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildPackBindingName'", id.BuildPackBindingName, "buildPackBindingName") + } +} + +func TestFormatBuildPackBindingID(t *testing.T) { + actual := NewBuildPackBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "builderName", "buildPackBindingName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings/buildPackBindingName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseBuildPackBindingID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuildPackBindingId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings/buildPackBindingName", + Expected: &BuildPackBindingId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuilderName: "builderName", + BuildPackBindingName: "buildPackBindingName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings/buildPackBindingName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuildPackBindingID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuilderName != v.Expected.BuilderName { + t.Fatalf("Expected %q but got %q for BuilderName", v.Expected.BuilderName, actual.BuilderName) + } + + if actual.BuildPackBindingName != v.Expected.BuildPackBindingName { + t.Fatalf("Expected %q but got %q for BuildPackBindingName", v.Expected.BuildPackBindingName, actual.BuildPackBindingName) + } + + } +} + +func TestParseBuildPackBindingIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuildPackBindingId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS/bUiLdErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS/bUiLdErNaMe/bUiLdPaCkBiNdInGs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings/buildPackBindingName", + Expected: &BuildPackBindingId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuilderName: "builderName", + BuildPackBindingName: "buildPackBindingName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builders/builderName/buildPackBindings/buildPackBindingName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS/bUiLdErNaMe/bUiLdPaCkBiNdInGs/bUiLdPaCkBiNdInGnAmE", + Expected: &BuildPackBindingId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + BuilderName: "bUiLdErNaMe", + BuildPackBindingName: "bUiLdPaCkBiNdInGnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdErS/bUiLdErNaMe/bUiLdPaCkBiNdInGs/bUiLdPaCkBiNdInGnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuildPackBindingIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuilderName != v.Expected.BuilderName { + t.Fatalf("Expected %q but got %q for BuilderName", v.Expected.BuilderName, actual.BuilderName) + } + + if actual.BuildPackBindingName != v.Expected.BuildPackBindingName { + t.Fatalf("Expected %q but got %q for BuildPackBindingName", v.Expected.BuildPackBindingName, actual.BuildPackBindingName) + } + + } +} + +func TestSegmentsForBuildPackBindingId(t *testing.T) { + segments := BuildPackBindingId{}.Segments() + if len(segments) == 0 { + t.Fatalf("BuildPackBindingId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice.go new file mode 100644 index 00000000000..28fa106aa36 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&BuildServiceId{}) +} + +var _ resourceids.ResourceId = &BuildServiceId{} + +// BuildServiceId is a struct representing the Resource ID for a Build Service +type BuildServiceId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string +} + +// NewBuildServiceID returns a new BuildServiceId struct +func NewBuildServiceID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string) BuildServiceId { + return BuildServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + } +} + +// ParseBuildServiceID parses 'input' into a BuildServiceId +func ParseBuildServiceID(input string) (*BuildServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuildServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuildServiceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBuildServiceIDInsensitively parses 'input' case-insensitively into a BuildServiceId +// note: this method should only be used for API response data and not user input +func ParseBuildServiceIDInsensitively(input string) (*BuildServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(&BuildServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BuildServiceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + return nil +} + +// ValidateBuildServiceID checks that 'input' can be parsed as a Build Service ID +func ValidateBuildServiceID(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 := ParseBuildServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Build Service ID +func (id BuildServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Build Service ID +func (id BuildServiceId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + } +} + +// String returns a human-readable description of this Build Service ID +func (id BuildServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + } + return fmt.Sprintf("Build Service (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice_test.go new file mode 100644 index 00000000000..d533db08627 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_buildservice_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &BuildServiceId{} + +func TestNewBuildServiceID(t *testing.T) { + id := NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } +} + +func TestFormatBuildServiceID(t *testing.T) { + actual := NewBuildServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseBuildServiceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuildServiceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Expected: &BuildServiceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuildServiceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + } +} + +func TestParseBuildServiceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *BuildServiceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Expected: &BuildServiceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Expected: &BuildServiceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseBuildServiceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + } +} + +func TestSegmentsForBuildServiceId(t *testing.T) { + segments := BuildServiceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("BuildServiceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate.go new file mode 100644 index 00000000000..d5868a74e0e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&CertificateId{}) +} + +var _ resourceids.ResourceId = &CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, springName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(&CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CertificateId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(&CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CertificateId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) + } + + return nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(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 := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateName"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate_test.go new file mode 100644 index 00000000000..05e25275c3e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_certificate_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &CertificateId{} + +func TestNewCertificateID(t *testing.T) { + id := NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "certificateName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.CertificateName != "certificateName" { + t.Fatalf("Expected %q but got %q for Segment 'CertificateName'", id.CertificateName, "certificateName") + } +} + +func TestFormatCertificateID(t *testing.T) { + actual := NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "certificateName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates/certificateName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCertificateID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CertificateId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates/certificateName", + Expected: &CertificateId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + CertificateName: "certificateName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates/certificateName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCertificateID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.CertificateName != v.Expected.CertificateName { + t.Fatalf("Expected %q but got %q for CertificateName", v.Expected.CertificateName, actual.CertificateName) + } + + } +} + +func TestParseCertificateIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CertificateId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cErTiFiCaTeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates/certificateName", + Expected: &CertificateId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + CertificateName: "certificateName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/certificates/certificateName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cErTiFiCaTeS/cErTiFiCaTeNaMe", + Expected: &CertificateId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + CertificateName: "cErTiFiCaTeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cErTiFiCaTeS/cErTiFiCaTeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCertificateIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.CertificateName != v.Expected.CertificateName { + t.Fatalf("Expected %q but got %q for CertificateName", v.Expected.CertificateName, actual.CertificateName) + } + + } +} + +func TestSegmentsForCertificateId(t *testing.T) { + segments := CertificateId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CertificateId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice.go new file mode 100644 index 00000000000..817d387c863 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ConfigurationServiceId{}) +} + +var _ resourceids.ResourceId = &ConfigurationServiceId{} + +// ConfigurationServiceId is a struct representing the Resource ID for a Configuration Service +type ConfigurationServiceId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ConfigurationServiceName string +} + +// NewConfigurationServiceID returns a new ConfigurationServiceId struct +func NewConfigurationServiceID(subscriptionId string, resourceGroupName string, springName string, configurationServiceName string) ConfigurationServiceId { + return ConfigurationServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ConfigurationServiceName: configurationServiceName, + } +} + +// ParseConfigurationServiceID parses 'input' into a ConfigurationServiceId +func ParseConfigurationServiceID(input string) (*ConfigurationServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ConfigurationServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ConfigurationServiceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseConfigurationServiceIDInsensitively parses 'input' case-insensitively into a ConfigurationServiceId +// note: this method should only be used for API response data and not user input +func ParseConfigurationServiceIDInsensitively(input string) (*ConfigurationServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ConfigurationServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ConfigurationServiceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ConfigurationServiceName, ok = input.Parsed["configurationServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", input) + } + + return nil +} + +// ValidateConfigurationServiceID checks that 'input' can be parsed as a Configuration Service ID +func ValidateConfigurationServiceID(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 := ParseConfigurationServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration Service ID +func (id ConfigurationServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/configurationServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ConfigurationServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration Service ID +func (id ConfigurationServiceId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticConfigurationServices", "configurationServices", "configurationServices"), + resourceids.UserSpecifiedSegment("configurationServiceName", "configurationServiceName"), + } +} + +// String returns a human-readable description of this Configuration Service ID +func (id ConfigurationServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Configuration Service Name: %q", id.ConfigurationServiceName), + } + return fmt.Sprintf("Configuration Service (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice_test.go new file mode 100644 index 00000000000..53ee62ebfd7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_configurationservice_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ConfigurationServiceId{} + +func TestNewConfigurationServiceID(t *testing.T) { + id := NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ConfigurationServiceName != "configurationServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'ConfigurationServiceName'", id.ConfigurationServiceName, "configurationServiceName") + } +} + +func TestFormatConfigurationServiceID(t *testing.T) { + actual := NewConfigurationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "configurationServiceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices/configurationServiceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseConfigurationServiceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ConfigurationServiceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices/configurationServiceName", + Expected: &ConfigurationServiceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ConfigurationServiceName: "configurationServiceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices/configurationServiceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseConfigurationServiceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ConfigurationServiceName != v.Expected.ConfigurationServiceName { + t.Fatalf("Expected %q but got %q for ConfigurationServiceName", v.Expected.ConfigurationServiceName, actual.ConfigurationServiceName) + } + + } +} + +func TestParseConfigurationServiceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ConfigurationServiceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cOnFiGuRaTiOnSeRvIcEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices/configurationServiceName", + Expected: &ConfigurationServiceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ConfigurationServiceName: "configurationServiceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/configurationServices/configurationServiceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cOnFiGuRaTiOnSeRvIcEs/cOnFiGuRaTiOnSeRvIcEnAmE", + Expected: &ConfigurationServiceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ConfigurationServiceName: "cOnFiGuRaTiOnSeRvIcEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cOnFiGuRaTiOnSeRvIcEs/cOnFiGuRaTiOnSeRvIcEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseConfigurationServiceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ConfigurationServiceName != v.Expected.ConfigurationServiceName { + t.Fatalf("Expected %q but got %q for ConfigurationServiceName", v.Expected.ConfigurationServiceName, actual.ConfigurationServiceName) + } + + } +} + +func TestSegmentsForConfigurationServiceId(t *testing.T) { + segments := ConfigurationServiceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ConfigurationServiceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry.go new file mode 100644 index 00000000000..16c77ae4b97 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ContainerRegistryId{}) +} + +var _ resourceids.ResourceId = &ContainerRegistryId{} + +// ContainerRegistryId is a struct representing the Resource ID for a Container Registry +type ContainerRegistryId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ContainerRegistryName string +} + +// NewContainerRegistryID returns a new ContainerRegistryId struct +func NewContainerRegistryID(subscriptionId string, resourceGroupName string, springName string, containerRegistryName string) ContainerRegistryId { + return ContainerRegistryId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ContainerRegistryName: containerRegistryName, + } +} + +// ParseContainerRegistryID parses 'input' into a ContainerRegistryId +func ParseContainerRegistryID(input string) (*ContainerRegistryId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerRegistryId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerRegistryId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseContainerRegistryIDInsensitively parses 'input' case-insensitively into a ContainerRegistryId +// note: this method should only be used for API response data and not user input +func ParseContainerRegistryIDInsensitively(input string) (*ContainerRegistryId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerRegistryId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerRegistryId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ContainerRegistryName, ok = input.Parsed["containerRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", input) + } + + return nil +} + +// ValidateContainerRegistryID checks that 'input' can be parsed as a Container Registry ID +func ValidateContainerRegistryID(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 := ParseContainerRegistryID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container Registry ID +func (id ContainerRegistryId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/containerRegistries/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ContainerRegistryName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container Registry ID +func (id ContainerRegistryId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticContainerRegistries", "containerRegistries", "containerRegistries"), + resourceids.UserSpecifiedSegment("containerRegistryName", "containerRegistryName"), + } +} + +// String returns a human-readable description of this Container Registry ID +func (id ContainerRegistryId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Container Registry Name: %q", id.ContainerRegistryName), + } + return fmt.Sprintf("Container Registry (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry_test.go new file mode 100644 index 00000000000..9ba67e6eeb5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_containerregistry_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ContainerRegistryId{} + +func TestNewContainerRegistryID(t *testing.T) { + id := NewContainerRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "containerRegistryName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ContainerRegistryName != "containerRegistryName" { + t.Fatalf("Expected %q but got %q for Segment 'ContainerRegistryName'", id.ContainerRegistryName, "containerRegistryName") + } +} + +func TestFormatContainerRegistryID(t *testing.T) { + actual := NewContainerRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "containerRegistryName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries/containerRegistryName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseContainerRegistryID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerRegistryId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries/containerRegistryName", + Expected: &ContainerRegistryId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ContainerRegistryName: "containerRegistryName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries/containerRegistryName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerRegistryID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ContainerRegistryName != v.Expected.ContainerRegistryName { + t.Fatalf("Expected %q but got %q for ContainerRegistryName", v.Expected.ContainerRegistryName, actual.ContainerRegistryName) + } + + } +} + +func TestParseContainerRegistryIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerRegistryId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cOnTaInErReGiStRiEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries/containerRegistryName", + Expected: &ContainerRegistryId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ContainerRegistryName: "containerRegistryName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/containerRegistries/containerRegistryName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cOnTaInErReGiStRiEs/cOnTaInErReGiStRyNaMe", + Expected: &ContainerRegistryId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ContainerRegistryName: "cOnTaInErReGiStRyNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/cOnTaInErReGiStRiEs/cOnTaInErReGiStRyNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerRegistryIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ContainerRegistryName != v.Expected.ContainerRegistryName { + t.Fatalf("Expected %q but got %q for ContainerRegistryName", v.Expected.ContainerRegistryName, actual.ContainerRegistryName) + } + + } +} + +func TestSegmentsForContainerRegistryId(t *testing.T) { + segments := ContainerRegistryId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ContainerRegistryId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator.go new file mode 100644 index 00000000000..244567c6cd9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&CustomizedAcceleratorId{}) +} + +var _ resourceids.ResourceId = &CustomizedAcceleratorId{} + +// CustomizedAcceleratorId is a struct representing the Resource ID for a Customized Accelerator +type CustomizedAcceleratorId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApplicationAcceleratorName string + CustomizedAcceleratorName string +} + +// NewCustomizedAcceleratorID returns a new CustomizedAcceleratorId struct +func NewCustomizedAcceleratorID(subscriptionId string, resourceGroupName string, springName string, applicationAcceleratorName string, customizedAcceleratorName string) CustomizedAcceleratorId { + return CustomizedAcceleratorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApplicationAcceleratorName: applicationAcceleratorName, + CustomizedAcceleratorName: customizedAcceleratorName, + } +} + +// ParseCustomizedAcceleratorID parses 'input' into a CustomizedAcceleratorId +func ParseCustomizedAcceleratorID(input string) (*CustomizedAcceleratorId, error) { + parser := resourceids.NewParserFromResourceIdType(&CustomizedAcceleratorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CustomizedAcceleratorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCustomizedAcceleratorIDInsensitively parses 'input' case-insensitively into a CustomizedAcceleratorId +// note: this method should only be used for API response data and not user input +func ParseCustomizedAcceleratorIDInsensitively(input string) (*CustomizedAcceleratorId, error) { + parser := resourceids.NewParserFromResourceIdType(&CustomizedAcceleratorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CustomizedAcceleratorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomizedAcceleratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) + } + + if id.CustomizedAcceleratorName, ok = input.Parsed["customizedAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", input) + } + + return nil +} + +// ValidateCustomizedAcceleratorID checks that 'input' can be parsed as a Customized Accelerator ID +func ValidateCustomizedAcceleratorID(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 := ParseCustomizedAcceleratorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Customized Accelerator ID +func (id CustomizedAcceleratorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/applicationAccelerators/%s/customizedAccelerators/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApplicationAcceleratorName, id.CustomizedAcceleratorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Customized Accelerator ID +func (id CustomizedAcceleratorId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApplicationAccelerators", "applicationAccelerators", "applicationAccelerators"), + resourceids.UserSpecifiedSegment("applicationAcceleratorName", "applicationAcceleratorName"), + resourceids.StaticSegment("staticCustomizedAccelerators", "customizedAccelerators", "customizedAccelerators"), + resourceids.UserSpecifiedSegment("customizedAcceleratorName", "customizedAcceleratorName"), + } +} + +// String returns a human-readable description of this Customized Accelerator ID +func (id CustomizedAcceleratorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Application Accelerator Name: %q", id.ApplicationAcceleratorName), + fmt.Sprintf("Customized Accelerator Name: %q", id.CustomizedAcceleratorName), + } + return fmt.Sprintf("Customized Accelerator (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator_test.go new file mode 100644 index 00000000000..2ef35c36e0d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_customizedaccelerator_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &CustomizedAcceleratorId{} + +func TestNewCustomizedAcceleratorID(t *testing.T) { + id := NewCustomizedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "customizedAcceleratorName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApplicationAcceleratorName != "applicationAcceleratorName" { + t.Fatalf("Expected %q but got %q for Segment 'ApplicationAcceleratorName'", id.ApplicationAcceleratorName, "applicationAcceleratorName") + } + + if id.CustomizedAcceleratorName != "customizedAcceleratorName" { + t.Fatalf("Expected %q but got %q for Segment 'CustomizedAcceleratorName'", id.CustomizedAcceleratorName, "customizedAcceleratorName") + } +} + +func TestFormatCustomizedAcceleratorID(t *testing.T) { + actual := NewCustomizedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "customizedAcceleratorName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators/customizedAcceleratorName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCustomizedAcceleratorID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CustomizedAcceleratorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators/customizedAcceleratorName", + Expected: &CustomizedAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationAcceleratorName: "applicationAcceleratorName", + CustomizedAcceleratorName: "customizedAcceleratorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators/customizedAcceleratorName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCustomizedAcceleratorID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationAcceleratorName != v.Expected.ApplicationAcceleratorName { + t.Fatalf("Expected %q but got %q for ApplicationAcceleratorName", v.Expected.ApplicationAcceleratorName, actual.ApplicationAcceleratorName) + } + + if actual.CustomizedAcceleratorName != v.Expected.CustomizedAcceleratorName { + t.Fatalf("Expected %q but got %q for CustomizedAcceleratorName", v.Expected.CustomizedAcceleratorName, actual.CustomizedAcceleratorName) + } + + } +} + +func TestParseCustomizedAcceleratorIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CustomizedAcceleratorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/cUsToMiZeDaCcElErAtOrS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators/customizedAcceleratorName", + Expected: &CustomizedAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationAcceleratorName: "applicationAcceleratorName", + CustomizedAcceleratorName: "customizedAcceleratorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/customizedAccelerators/customizedAcceleratorName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/cUsToMiZeDaCcElErAtOrS/cUsToMiZeDaCcElErAtOrNaMe", + Expected: &CustomizedAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApplicationAcceleratorName: "aPpLiCaTiOnAcCeLeRaToRnAmE", + CustomizedAcceleratorName: "cUsToMiZeDaCcElErAtOrNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/cUsToMiZeDaCcElErAtOrS/cUsToMiZeDaCcElErAtOrNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCustomizedAcceleratorIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationAcceleratorName != v.Expected.ApplicationAcceleratorName { + t.Fatalf("Expected %q but got %q for ApplicationAcceleratorName", v.Expected.ApplicationAcceleratorName, actual.ApplicationAcceleratorName) + } + + if actual.CustomizedAcceleratorName != v.Expected.CustomizedAcceleratorName { + t.Fatalf("Expected %q but got %q for CustomizedAcceleratorName", v.Expected.CustomizedAcceleratorName, actual.CustomizedAcceleratorName) + } + + } +} + +func TestSegmentsForCustomizedAcceleratorId(t *testing.T) { + segments := CustomizedAcceleratorId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CustomizedAcceleratorId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment.go new file mode 100644 index 00000000000..6d1f6af4285 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&DeploymentId{}) +} + +var _ resourceids.ResourceId = &DeploymentId{} + +// DeploymentId is a struct representing the Resource ID for a Deployment +type DeploymentId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + AppName string + DeploymentName string +} + +// NewDeploymentID returns a new DeploymentId struct +func NewDeploymentID(subscriptionId string, resourceGroupName string, springName string, appName string, deploymentName string) DeploymentId { + return DeploymentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + AppName: appName, + DeploymentName: deploymentName, + } +} + +// ParseDeploymentID parses 'input' into a DeploymentId +func ParseDeploymentID(input string) (*DeploymentId, error) { + parser := resourceids.NewParserFromResourceIdType(&DeploymentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DeploymentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDeploymentIDInsensitively parses 'input' case-insensitively into a DeploymentId +// note: this method should only be used for API response data and not user input +func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { + parser := resourceids.NewParserFromResourceIdType(&DeploymentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DeploymentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) + } + + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) + } + + return nil +} + +// ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID +func ValidateDeploymentID(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 := ParseDeploymentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Deployment ID +func (id DeploymentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apps/%s/deployments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.AppName, id.DeploymentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Deployment ID +func (id DeploymentId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApps", "apps", "apps"), + resourceids.UserSpecifiedSegment("appName", "appName"), + resourceids.StaticSegment("staticDeployments", "deployments", "deployments"), + resourceids.UserSpecifiedSegment("deploymentName", "deploymentName"), + } +} + +// String returns a human-readable description of this Deployment ID +func (id DeploymentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("App Name: %q", id.AppName), + fmt.Sprintf("Deployment Name: %q", id.DeploymentName), + } + return fmt.Sprintf("Deployment (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment_test.go new file mode 100644 index 00000000000..ecc58d8f5a9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_deployment_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &DeploymentId{} + +func TestNewDeploymentID(t *testing.T) { + id := NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.AppName != "appName" { + t.Fatalf("Expected %q but got %q for Segment 'AppName'", id.AppName, "appName") + } + + if id.DeploymentName != "deploymentName" { + t.Fatalf("Expected %q but got %q for Segment 'DeploymentName'", id.DeploymentName, "deploymentName") + } +} + +func TestFormatDeploymentID(t *testing.T) { + actual := NewDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "deploymentName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments/deploymentName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDeploymentID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DeploymentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments/deploymentName", + Expected: &DeploymentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + DeploymentName: "deploymentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments/deploymentName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDeploymentID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + if actual.DeploymentName != v.Expected.DeploymentName { + t.Fatalf("Expected %q but got %q for DeploymentName", v.Expected.DeploymentName, actual.DeploymentName) + } + + } +} + +func TestParseDeploymentIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DeploymentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/dEpLoYmEnTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments/deploymentName", + Expected: &DeploymentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + DeploymentName: "deploymentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/deployments/deploymentName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/dEpLoYmEnTs/dEpLoYmEnTnAmE", + Expected: &DeploymentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + AppName: "aPpNaMe", + DeploymentName: "dEpLoYmEnTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/dEpLoYmEnTs/dEpLoYmEnTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDeploymentIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + if actual.DeploymentName != v.Expected.DeploymentName { + t.Fatalf("Expected %q but got %q for DeploymentName", v.Expected.DeploymentName, actual.DeploymentName) + } + + } +} + +func TestSegmentsForDeploymentId(t *testing.T) { + segments := DeploymentId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DeploymentId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal.go new file mode 100644 index 00000000000..f039e8ec1b8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&DevToolPortalId{}) +} + +var _ resourceids.ResourceId = &DevToolPortalId{} + +// DevToolPortalId is a struct representing the Resource ID for a Dev Tool Portal +type DevToolPortalId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + DevToolPortalName string +} + +// NewDevToolPortalID returns a new DevToolPortalId struct +func NewDevToolPortalID(subscriptionId string, resourceGroupName string, springName string, devToolPortalName string) DevToolPortalId { + return DevToolPortalId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + DevToolPortalName: devToolPortalName, + } +} + +// ParseDevToolPortalID parses 'input' into a DevToolPortalId +func ParseDevToolPortalID(input string) (*DevToolPortalId, error) { + parser := resourceids.NewParserFromResourceIdType(&DevToolPortalId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DevToolPortalId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDevToolPortalIDInsensitively parses 'input' case-insensitively into a DevToolPortalId +// note: this method should only be used for API response data and not user input +func ParseDevToolPortalIDInsensitively(input string) (*DevToolPortalId, error) { + parser := resourceids.NewParserFromResourceIdType(&DevToolPortalId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DevToolPortalId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevToolPortalId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.DevToolPortalName, ok = input.Parsed["devToolPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", input) + } + + return nil +} + +// ValidateDevToolPortalID checks that 'input' can be parsed as a Dev Tool Portal ID +func ValidateDevToolPortalID(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 := ParseDevToolPortalID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dev Tool Portal ID +func (id DevToolPortalId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/devToolPortals/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.DevToolPortalName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dev Tool Portal ID +func (id DevToolPortalId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticDevToolPortals", "devToolPortals", "devToolPortals"), + resourceids.UserSpecifiedSegment("devToolPortalName", "devToolPortalName"), + } +} + +// String returns a human-readable description of this Dev Tool Portal ID +func (id DevToolPortalId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Dev Tool Portal Name: %q", id.DevToolPortalName), + } + return fmt.Sprintf("Dev Tool Portal (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal_test.go new file mode 100644 index 00000000000..d6208db3ef4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_devtoolportal_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &DevToolPortalId{} + +func TestNewDevToolPortalID(t *testing.T) { + id := NewDevToolPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "devToolPortalName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.DevToolPortalName != "devToolPortalName" { + t.Fatalf("Expected %q but got %q for Segment 'DevToolPortalName'", id.DevToolPortalName, "devToolPortalName") + } +} + +func TestFormatDevToolPortalID(t *testing.T) { + actual := NewDevToolPortalID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "devToolPortalName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals/devToolPortalName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDevToolPortalID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DevToolPortalId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals/devToolPortalName", + Expected: &DevToolPortalId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + DevToolPortalName: "devToolPortalName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals/devToolPortalName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDevToolPortalID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.DevToolPortalName != v.Expected.DevToolPortalName { + t.Fatalf("Expected %q but got %q for DevToolPortalName", v.Expected.DevToolPortalName, actual.DevToolPortalName) + } + + } +} + +func TestParseDevToolPortalIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DevToolPortalId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/dEvToOlPoRtAlS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals/devToolPortalName", + Expected: &DevToolPortalId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + DevToolPortalName: "devToolPortalName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/devToolPortals/devToolPortalName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/dEvToOlPoRtAlS/dEvToOlPoRtAlNaMe", + Expected: &DevToolPortalId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + DevToolPortalName: "dEvToOlPoRtAlNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/dEvToOlPoRtAlS/dEvToOlPoRtAlNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDevToolPortalIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.DevToolPortalName != v.Expected.DevToolPortalName { + t.Fatalf("Expected %q but got %q for DevToolPortalName", v.Expected.DevToolPortalName, actual.DevToolPortalName) + } + + } +} + +func TestSegmentsForDevToolPortalId(t *testing.T) { + segments := DevToolPortalId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DevToolPortalId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain.go new file mode 100644 index 00000000000..533d7b953fe --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&DomainId{}) +} + +var _ resourceids.ResourceId = &DomainId{} + +// DomainId is a struct representing the Resource ID for a Domain +type DomainId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + AppName string + DomainName string +} + +// NewDomainID returns a new DomainId struct +func NewDomainID(subscriptionId string, resourceGroupName string, springName string, appName string, domainName string) DomainId { + return DomainId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + AppName: appName, + DomainName: domainName, + } +} + +// ParseDomainID parses 'input' into a DomainId +func ParseDomainID(input string) (*DomainId, error) { + parser := resourceids.NewParserFromResourceIdType(&DomainId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DomainId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDomainIDInsensitively parses 'input' case-insensitively into a DomainId +// note: this method should only be used for API response data and not user input +func ParseDomainIDInsensitively(input string) (*DomainId, error) { + parser := resourceids.NewParserFromResourceIdType(&DomainId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DomainId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) + } + + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) + } + + return nil +} + +// ValidateDomainID checks that 'input' can be parsed as a Domain ID +func ValidateDomainID(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 := ParseDomainID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Domain ID +func (id DomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/apps/%s/domains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.AppName, id.DomainName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Domain ID +func (id DomainId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApps", "apps", "apps"), + resourceids.UserSpecifiedSegment("appName", "appName"), + resourceids.StaticSegment("staticDomains", "domains", "domains"), + resourceids.UserSpecifiedSegment("domainName", "domainName"), + } +} + +// String returns a human-readable description of this Domain ID +func (id DomainId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("App Name: %q", id.AppName), + fmt.Sprintf("Domain Name: %q", id.DomainName), + } + return fmt.Sprintf("Domain (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain_test.go new file mode 100644 index 00000000000..b06984a8b5d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_domain_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &DomainId{} + +func TestNewDomainID(t *testing.T) { + id := NewDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "domainName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.AppName != "appName" { + t.Fatalf("Expected %q but got %q for Segment 'AppName'", id.AppName, "appName") + } + + if id.DomainName != "domainName" { + t.Fatalf("Expected %q but got %q for Segment 'DomainName'", id.DomainName, "domainName") + } +} + +func TestFormatDomainID(t *testing.T) { + actual := NewDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "appName", "domainName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains/domainName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDomainID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DomainId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains/domainName", + Expected: &DomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + DomainName: "domainName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains/domainName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDomainID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + if actual.DomainName != v.Expected.DomainName { + t.Fatalf("Expected %q but got %q for DomainName", v.Expected.DomainName, actual.DomainName) + } + + } +} + +func TestParseDomainIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DomainId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/dOmAiNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains/domainName", + Expected: &DomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + AppName: "appName", + DomainName: "domainName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/apps/appName/domains/domainName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/dOmAiNs/dOmAiNnAmE", + Expected: &DomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + AppName: "aPpNaMe", + DomainName: "dOmAiNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpS/aPpNaMe/dOmAiNs/dOmAiNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDomainIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.AppName != v.Expected.AppName { + t.Fatalf("Expected %q but got %q for AppName", v.Expected.AppName, actual.AppName) + } + + if actual.DomainName != v.Expected.DomainName { + t.Fatalf("Expected %q but got %q for DomainName", v.Expected.DomainName, actual.DomainName) + } + + } +} + +func TestSegmentsForDomainId(t *testing.T) { + segments := DomainId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DomainId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution.go new file mode 100644 index 00000000000..0debd6347fd --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ExecutionId{}) +} + +var _ resourceids.ResourceId = &ExecutionId{} + +// ExecutionId is a struct representing the Resource ID for a Execution +type ExecutionId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + JobName string + ExecutionName string +} + +// NewExecutionID returns a new ExecutionId struct +func NewExecutionID(subscriptionId string, resourceGroupName string, springName string, jobName string, executionName string) ExecutionId { + return ExecutionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + JobName: jobName, + ExecutionName: executionName, + } +} + +// ParseExecutionID parses 'input' into a ExecutionId +func ParseExecutionID(input string) (*ExecutionId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExecutionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExecutionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExecutionIDInsensitively parses 'input' case-insensitively into a ExecutionId +// note: this method should only be used for API response data and not user input +func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExecutionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExecutionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) + } + + if id.ExecutionName, ok = input.Parsed["executionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "executionName", input) + } + + return nil +} + +// ValidateExecutionID checks that 'input' can be parsed as a Execution ID +func ValidateExecutionID(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 := ParseExecutionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Execution ID +func (id ExecutionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/jobs/%s/executions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.JobName, id.ExecutionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Execution ID +func (id ExecutionId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticJobs", "jobs", "jobs"), + resourceids.UserSpecifiedSegment("jobName", "jobName"), + resourceids.StaticSegment("staticExecutions", "executions", "executions"), + resourceids.UserSpecifiedSegment("executionName", "executionName"), + } +} + +// String returns a human-readable description of this Execution ID +func (id ExecutionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Execution Name: %q", id.ExecutionName), + } + return fmt.Sprintf("Execution (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution_test.go new file mode 100644 index 00000000000..21d5ce6b3de --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_execution_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &ExecutionId{} + +func TestNewExecutionID(t *testing.T) { + id := NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName", "executionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.JobName != "jobName" { + t.Fatalf("Expected %q but got %q for Segment 'JobName'", id.JobName, "jobName") + } + + if id.ExecutionName != "executionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExecutionName'", id.ExecutionName, "executionName") + } +} + +func TestFormatExecutionID(t *testing.T) { + actual := NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName", "executionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions/executionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExecutionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExecutionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions/executionName", + Expected: &ExecutionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + JobName: "jobName", + ExecutionName: "executionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions/executionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExecutionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.JobName != v.Expected.JobName { + t.Fatalf("Expected %q but got %q for JobName", v.Expected.JobName, actual.JobName) + } + + if actual.ExecutionName != v.Expected.ExecutionName { + t.Fatalf("Expected %q but got %q for ExecutionName", v.Expected.ExecutionName, actual.ExecutionName) + } + + } +} + +func TestParseExecutionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExecutionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS/jObNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS/jObNaMe/eXeCuTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions/executionName", + Expected: &ExecutionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + JobName: "jobName", + ExecutionName: "executionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/executions/executionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS/jObNaMe/eXeCuTiOnS/eXeCuTiOnNaMe", + Expected: &ExecutionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + JobName: "jObNaMe", + ExecutionName: "eXeCuTiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS/jObNaMe/eXeCuTiOnS/eXeCuTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExecutionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.JobName != v.Expected.JobName { + t.Fatalf("Expected %q but got %q for JobName", v.Expected.JobName, actual.JobName) + } + + if actual.ExecutionName != v.Expected.ExecutionName { + t.Fatalf("Expected %q but got %q for ExecutionName", v.Expected.ExecutionName, actual.ExecutionName) + } + + } +} + +func TestSegmentsForExecutionId(t *testing.T) { + segments := ExecutionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExecutionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway.go new file mode 100644 index 00000000000..197e3a1e57a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&GatewayId{}) +} + +var _ resourceids.ResourceId = &GatewayId{} + +// GatewayId is a struct representing the Resource ID for a Gateway +type GatewayId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + GatewayName string +} + +// NewGatewayID returns a new GatewayId struct +func NewGatewayID(subscriptionId string, resourceGroupName string, springName string, gatewayName string) GatewayId { + return GatewayId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + GatewayName: gatewayName, + } +} + +// ParseGatewayID parses 'input' into a GatewayId +func ParseGatewayID(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(&GatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GatewayId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseGatewayIDInsensitively parses 'input' case-insensitively into a GatewayId +// note: this method should only be used for API response data and not user input +func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(&GatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GatewayId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) + } + + return nil +} + +// ValidateGatewayID checks that 'input' can be parsed as a Gateway ID +func ValidateGatewayID(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 := ParseGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway ID +func (id GatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/gateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.GatewayName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway ID +func (id GatewayId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayName", "gatewayName"), + } +} + +// String returns a human-readable description of this Gateway ID +func (id GatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Gateway Name: %q", id.GatewayName), + } + return fmt.Sprintf("Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway_test.go new file mode 100644 index 00000000000..78f6d73a37b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gateway_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &GatewayId{} + +func TestNewGatewayID(t *testing.T) { + id := NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.GatewayName != "gatewayName" { + t.Fatalf("Expected %q but got %q for Segment 'GatewayName'", id.GatewayName, "gatewayName") + } +} + +func TestFormatGatewayID(t *testing.T) { + actual := NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseGatewayID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GatewayId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName", + Expected: &GatewayId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + GatewayName: "gatewayName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGatewayID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.GatewayName != v.Expected.GatewayName { + t.Fatalf("Expected %q but got %q for GatewayName", v.Expected.GatewayName, actual.GatewayName) + } + + } +} + +func TestParseGatewayIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GatewayId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName", + Expected: &GatewayId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + GatewayName: "gatewayName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe", + Expected: &GatewayId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + GatewayName: "gAtEwAyNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGatewayIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.GatewayName != v.Expected.GatewayName { + t.Fatalf("Expected %q but got %q for GatewayName", v.Expected.GatewayName, actual.GatewayName) + } + + } +} + +func TestSegmentsForGatewayId(t *testing.T) { + segments := GatewayId{}.Segments() + if len(segments) == 0 { + t.Fatalf("GatewayId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain.go new file mode 100644 index 00000000000..e6977bb38d5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&GatewayDomainId{}) +} + +var _ resourceids.ResourceId = &GatewayDomainId{} + +// GatewayDomainId is a struct representing the Resource ID for a Gateway Domain +type GatewayDomainId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + GatewayName string + DomainName string +} + +// NewGatewayDomainID returns a new GatewayDomainId struct +func NewGatewayDomainID(subscriptionId string, resourceGroupName string, springName string, gatewayName string, domainName string) GatewayDomainId { + return GatewayDomainId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + GatewayName: gatewayName, + DomainName: domainName, + } +} + +// ParseGatewayDomainID parses 'input' into a GatewayDomainId +func ParseGatewayDomainID(input string) (*GatewayDomainId, error) { + parser := resourceids.NewParserFromResourceIdType(&GatewayDomainId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GatewayDomainId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseGatewayDomainIDInsensitively parses 'input' case-insensitively into a GatewayDomainId +// note: this method should only be used for API response data and not user input +func ParseGatewayDomainIDInsensitively(input string) (*GatewayDomainId, error) { + parser := resourceids.NewParserFromResourceIdType(&GatewayDomainId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GatewayDomainId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) + } + + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) + } + + return nil +} + +// ValidateGatewayDomainID checks that 'input' can be parsed as a Gateway Domain ID +func ValidateGatewayDomainID(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 := ParseGatewayDomainID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway Domain ID +func (id GatewayDomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/gateways/%s/domains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.GatewayName, id.DomainName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway Domain ID +func (id GatewayDomainId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayName", "gatewayName"), + resourceids.StaticSegment("staticDomains", "domains", "domains"), + resourceids.UserSpecifiedSegment("domainName", "domainName"), + } +} + +// String returns a human-readable description of this Gateway Domain ID +func (id GatewayDomainId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Gateway Name: %q", id.GatewayName), + fmt.Sprintf("Domain Name: %q", id.DomainName), + } + return fmt.Sprintf("Gateway Domain (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain_test.go new file mode 100644 index 00000000000..319edaa9acd --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_gatewaydomain_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &GatewayDomainId{} + +func TestNewGatewayDomainID(t *testing.T) { + id := NewGatewayDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "domainName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.GatewayName != "gatewayName" { + t.Fatalf("Expected %q but got %q for Segment 'GatewayName'", id.GatewayName, "gatewayName") + } + + if id.DomainName != "domainName" { + t.Fatalf("Expected %q but got %q for Segment 'DomainName'", id.DomainName, "domainName") + } +} + +func TestFormatGatewayDomainID(t *testing.T) { + actual := NewGatewayDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "domainName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains/domainName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseGatewayDomainID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GatewayDomainId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains/domainName", + Expected: &GatewayDomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + GatewayName: "gatewayName", + DomainName: "domainName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains/domainName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGatewayDomainID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.GatewayName != v.Expected.GatewayName { + t.Fatalf("Expected %q but got %q for GatewayName", v.Expected.GatewayName, actual.GatewayName) + } + + if actual.DomainName != v.Expected.DomainName { + t.Fatalf("Expected %q but got %q for DomainName", v.Expected.DomainName, actual.DomainName) + } + + } +} + +func TestParseGatewayDomainIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GatewayDomainId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/dOmAiNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains/domainName", + Expected: &GatewayDomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + GatewayName: "gatewayName", + DomainName: "domainName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/domains/domainName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/dOmAiNs/dOmAiNnAmE", + Expected: &GatewayDomainId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + GatewayName: "gAtEwAyNaMe", + DomainName: "dOmAiNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/dOmAiNs/dOmAiNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGatewayDomainIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.GatewayName != v.Expected.GatewayName { + t.Fatalf("Expected %q but got %q for GatewayName", v.Expected.GatewayName, actual.GatewayName) + } + + if actual.DomainName != v.Expected.DomainName { + t.Fatalf("Expected %q but got %q for DomainName", v.Expected.DomainName, actual.DomainName) + } + + } +} + +func TestSegmentsForGatewayDomainId(t *testing.T) { + segments := GatewayDomainId{}.Segments() + if len(segments) == 0 { + t.Fatalf("GatewayDomainId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_job.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_job.go new file mode 100644 index 00000000000..7032fc6ce8f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_job.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&JobId{}) +} + +var _ resourceids.ResourceId = &JobId{} + +// JobId is a struct representing the Resource ID for a Job +type JobId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + JobName string +} + +// NewJobID returns a new JobId struct +func NewJobID(subscriptionId string, resourceGroupName string, springName string, jobName string) JobId { + return JobId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + JobName: jobName, + } +} + +// ParseJobID parses 'input' into a JobId +func ParseJobID(input string) (*JobId, error) { + parser := resourceids.NewParserFromResourceIdType(&JobId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := JobId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseJobIDInsensitively parses 'input' case-insensitively into a JobId +// note: this method should only be used for API response data and not user input +func ParseJobIDInsensitively(input string) (*JobId, error) { + parser := resourceids.NewParserFromResourceIdType(&JobId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := JobId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) + } + + return nil +} + +// ValidateJobID checks that 'input' can be parsed as a Job ID +func ValidateJobID(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 := ParseJobID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Job ID +func (id JobId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/jobs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.JobName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Job ID +func (id JobId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticJobs", "jobs", "jobs"), + resourceids.UserSpecifiedSegment("jobName", "jobName"), + } +} + +// String returns a human-readable description of this Job ID +func (id JobId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Job Name: %q", id.JobName), + } + return fmt.Sprintf("Job (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_job_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_job_test.go new file mode 100644 index 00000000000..5fbd1f8f2b0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_job_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &JobId{} + +func TestNewJobID(t *testing.T) { + id := NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.JobName != "jobName" { + t.Fatalf("Expected %q but got %q for Segment 'JobName'", id.JobName, "jobName") + } +} + +func TestFormatJobID(t *testing.T) { + actual := NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "jobName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseJobID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *JobId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName", + Expected: &JobId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + JobName: "jobName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseJobID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.JobName != v.Expected.JobName { + t.Fatalf("Expected %q but got %q for JobName", v.Expected.JobName, actual.JobName) + } + + } +} + +func TestParseJobIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *JobId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName", + Expected: &JobId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + JobName: "jobName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/jobs/jobName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS/jObNaMe", + Expected: &JobId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + JobName: "jObNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/jObS/jObNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseJobIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.JobName != v.Expected.JobName { + t.Fatalf("Expected %q but got %q for JobName", v.Expected.JobName, actual.JobName) + } + + } +} + +func TestSegmentsForJobId(t *testing.T) { + segments := JobId{}.Segments() + if len(segments) == 0 { + t.Fatalf("JobId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_location.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_location.go new file mode 100644 index 00000000000..0aa97734894 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_location.go @@ -0,0 +1,121 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + 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) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return 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.AppPlatform/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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/resource-manager/appplatform/2024-05-01-preview/appplatform/id_location_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_location_test.go new file mode 100644 index 00000000000..2a3734a4076 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_location_test.go @@ -0,0 +1,237 @@ +package appplatform + +import ( + "testing" + + "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{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.AppPlatform/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator.go new file mode 100644 index 00000000000..cf14edf337c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&PredefinedAcceleratorId{}) +} + +var _ resourceids.ResourceId = &PredefinedAcceleratorId{} + +// PredefinedAcceleratorId is a struct representing the Resource ID for a Predefined Accelerator +type PredefinedAcceleratorId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ApplicationAcceleratorName string + PredefinedAcceleratorName string +} + +// NewPredefinedAcceleratorID returns a new PredefinedAcceleratorId struct +func NewPredefinedAcceleratorID(subscriptionId string, resourceGroupName string, springName string, applicationAcceleratorName string, predefinedAcceleratorName string) PredefinedAcceleratorId { + return PredefinedAcceleratorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ApplicationAcceleratorName: applicationAcceleratorName, + PredefinedAcceleratorName: predefinedAcceleratorName, + } +} + +// ParsePredefinedAcceleratorID parses 'input' into a PredefinedAcceleratorId +func ParsePredefinedAcceleratorID(input string) (*PredefinedAcceleratorId, error) { + parser := resourceids.NewParserFromResourceIdType(&PredefinedAcceleratorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PredefinedAcceleratorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePredefinedAcceleratorIDInsensitively parses 'input' case-insensitively into a PredefinedAcceleratorId +// note: this method should only be used for API response data and not user input +func ParsePredefinedAcceleratorIDInsensitively(input string) (*PredefinedAcceleratorId, error) { + parser := resourceids.NewParserFromResourceIdType(&PredefinedAcceleratorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PredefinedAcceleratorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PredefinedAcceleratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) + } + + if id.PredefinedAcceleratorName, ok = input.Parsed["predefinedAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", input) + } + + return nil +} + +// ValidatePredefinedAcceleratorID checks that 'input' can be parsed as a Predefined Accelerator ID +func ValidatePredefinedAcceleratorID(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 := ParsePredefinedAcceleratorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Predefined Accelerator ID +func (id PredefinedAcceleratorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/applicationAccelerators/%s/predefinedAccelerators/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ApplicationAcceleratorName, id.PredefinedAcceleratorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Predefined Accelerator ID +func (id PredefinedAcceleratorId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticApplicationAccelerators", "applicationAccelerators", "applicationAccelerators"), + resourceids.UserSpecifiedSegment("applicationAcceleratorName", "applicationAcceleratorName"), + resourceids.StaticSegment("staticPredefinedAccelerators", "predefinedAccelerators", "predefinedAccelerators"), + resourceids.UserSpecifiedSegment("predefinedAcceleratorName", "predefinedAcceleratorName"), + } +} + +// String returns a human-readable description of this Predefined Accelerator ID +func (id PredefinedAcceleratorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Application Accelerator Name: %q", id.ApplicationAcceleratorName), + fmt.Sprintf("Predefined Accelerator Name: %q", id.PredefinedAcceleratorName), + } + return fmt.Sprintf("Predefined Accelerator (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator_test.go new file mode 100644 index 00000000000..29e0d02f885 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_predefinedaccelerator_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &PredefinedAcceleratorId{} + +func TestNewPredefinedAcceleratorID(t *testing.T) { + id := NewPredefinedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "predefinedAcceleratorName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ApplicationAcceleratorName != "applicationAcceleratorName" { + t.Fatalf("Expected %q but got %q for Segment 'ApplicationAcceleratorName'", id.ApplicationAcceleratorName, "applicationAcceleratorName") + } + + if id.PredefinedAcceleratorName != "predefinedAcceleratorName" { + t.Fatalf("Expected %q but got %q for Segment 'PredefinedAcceleratorName'", id.PredefinedAcceleratorName, "predefinedAcceleratorName") + } +} + +func TestFormatPredefinedAcceleratorID(t *testing.T) { + actual := NewPredefinedAcceleratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "applicationAcceleratorName", "predefinedAcceleratorName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators/predefinedAcceleratorName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePredefinedAcceleratorID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PredefinedAcceleratorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators/predefinedAcceleratorName", + Expected: &PredefinedAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationAcceleratorName: "applicationAcceleratorName", + PredefinedAcceleratorName: "predefinedAcceleratorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators/predefinedAcceleratorName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePredefinedAcceleratorID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationAcceleratorName != v.Expected.ApplicationAcceleratorName { + t.Fatalf("Expected %q but got %q for ApplicationAcceleratorName", v.Expected.ApplicationAcceleratorName, actual.ApplicationAcceleratorName) + } + + if actual.PredefinedAcceleratorName != v.Expected.PredefinedAcceleratorName { + t.Fatalf("Expected %q but got %q for PredefinedAcceleratorName", v.Expected.PredefinedAcceleratorName, actual.PredefinedAcceleratorName) + } + + } +} + +func TestParsePredefinedAcceleratorIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PredefinedAcceleratorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/pReDeFiNeDaCcElErAtOrS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators/predefinedAcceleratorName", + Expected: &PredefinedAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ApplicationAcceleratorName: "applicationAcceleratorName", + PredefinedAcceleratorName: "predefinedAcceleratorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/applicationAccelerators/applicationAcceleratorName/predefinedAccelerators/predefinedAcceleratorName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/pReDeFiNeDaCcElErAtOrS/pReDeFiNeDaCcElErAtOrNaMe", + Expected: &PredefinedAcceleratorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ApplicationAcceleratorName: "aPpLiCaTiOnAcCeLeRaToRnAmE", + PredefinedAcceleratorName: "pReDeFiNeDaCcElErAtOrNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/aPpLiCaTiOnAcCeLeRaToRs/aPpLiCaTiOnAcCeLeRaToRnAmE/pReDeFiNeDaCcElErAtOrS/pReDeFiNeDaCcElErAtOrNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePredefinedAcceleratorIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ApplicationAcceleratorName != v.Expected.ApplicationAcceleratorName { + t.Fatalf("Expected %q but got %q for ApplicationAcceleratorName", v.Expected.ApplicationAcceleratorName, actual.ApplicationAcceleratorName) + } + + if actual.PredefinedAcceleratorName != v.Expected.PredefinedAcceleratorName { + t.Fatalf("Expected %q but got %q for PredefinedAcceleratorName", v.Expected.PredefinedAcceleratorName, actual.PredefinedAcceleratorName) + } + + } +} + +func TestSegmentsForPredefinedAcceleratorId(t *testing.T) { + segments := PredefinedAcceleratorId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PredefinedAcceleratorId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_result.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_result.go new file mode 100644 index 00000000000..d04c64aad61 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_result.go @@ -0,0 +1,157 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ResultId{}) +} + +var _ resourceids.ResourceId = &ResultId{} + +// ResultId is a struct representing the Resource ID for a Result +type ResultId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + BuildName string + ResultName string +} + +// NewResultID returns a new ResultId struct +func NewResultID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, buildName string, resultName string) ResultId { + return ResultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + BuildName: buildName, + ResultName: resultName, + } +} + +// ParseResultID parses 'input' into a ResultId +func ParseResultID(input string) (*ResultId, error) { + parser := resourceids.NewParserFromResourceIdType(&ResultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ResultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseResultIDInsensitively parses 'input' case-insensitively into a ResultId +// note: this method should only be used for API response data and not user input +func ParseResultIDInsensitively(input string) (*ResultId, error) { + parser := resourceids.NewParserFromResourceIdType(&ResultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ResultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ResultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) + } + + if id.ResultName, ok = input.Parsed["resultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resultName", input) + } + + return nil +} + +// ValidateResultID checks that 'input' can be parsed as a Result ID +func ValidateResultID(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 := ParseResultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Result ID +func (id ResultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/builds/%s/results/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.BuildName, id.ResultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Result ID +func (id ResultId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticBuilds", "builds", "builds"), + resourceids.UserSpecifiedSegment("buildName", "buildName"), + resourceids.StaticSegment("staticResults", "results", "results"), + resourceids.UserSpecifiedSegment("resultName", "resultName"), + } +} + +// String returns a human-readable description of this Result ID +func (id ResultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Build Name: %q", id.BuildName), + fmt.Sprintf("Result Name: %q", id.ResultName), + } + return fmt.Sprintf("Result (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_result_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_result_test.go new file mode 100644 index 00000000000..ce0167368f7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_result_test.go @@ -0,0 +1,417 @@ +package appplatform + +import ( + "testing" + + "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 = &ResultId{} + +func TestNewResultID(t *testing.T) { + id := NewResultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName", "resultName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.BuildName != "buildName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildName'", id.BuildName, "buildName") + } + + if id.ResultName != "resultName" { + t.Fatalf("Expected %q but got %q for Segment 'ResultName'", id.ResultName, "resultName") + } +} + +func TestFormatResultID(t *testing.T) { + actual := NewResultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "buildName", "resultName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results/resultName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseResultID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ResultId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results/resultName", + Expected: &ResultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuildName: "buildName", + ResultName: "resultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results/resultName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseResultID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuildName != v.Expected.BuildName { + t.Fatalf("Expected %q but got %q for BuildName", v.Expected.BuildName, actual.BuildName) + } + + if actual.ResultName != v.Expected.ResultName { + t.Fatalf("Expected %q but got %q for ResultName", v.Expected.ResultName, actual.ResultName) + } + + } +} + +func TestParseResultIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ResultId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS/bUiLdNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS/bUiLdNaMe/rEsUlTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results/resultName", + Expected: &ResultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + BuildName: "buildName", + ResultName: "resultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/builds/buildName/results/resultName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS/bUiLdNaMe/rEsUlTs/rEsUlTnAmE", + Expected: &ResultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + BuildName: "bUiLdNaMe", + ResultName: "rEsUlTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/bUiLdS/bUiLdNaMe/rEsUlTs/rEsUlTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseResultIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.BuildName != v.Expected.BuildName { + t.Fatalf("Expected %q but got %q for BuildName", v.Expected.BuildName, actual.BuildName) + } + + if actual.ResultName != v.Expected.ResultName { + t.Fatalf("Expected %q but got %q for ResultName", v.Expected.ResultName, actual.ResultName) + } + + } +} + +func TestSegmentsForResultId(t *testing.T) { + segments := ResultId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ResultId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig.go new file mode 100644 index 00000000000..7e7c1a3f8d1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&RouteConfigId{}) +} + +var _ resourceids.ResourceId = &RouteConfigId{} + +// RouteConfigId is a struct representing the Resource ID for a Route Config +type RouteConfigId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + GatewayName string + RouteConfigName string +} + +// NewRouteConfigID returns a new RouteConfigId struct +func NewRouteConfigID(subscriptionId string, resourceGroupName string, springName string, gatewayName string, routeConfigName string) RouteConfigId { + return RouteConfigId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + GatewayName: gatewayName, + RouteConfigName: routeConfigName, + } +} + +// ParseRouteConfigID parses 'input' into a RouteConfigId +func ParseRouteConfigID(input string) (*RouteConfigId, error) { + parser := resourceids.NewParserFromResourceIdType(&RouteConfigId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RouteConfigId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRouteConfigIDInsensitively parses 'input' case-insensitively into a RouteConfigId +// note: this method should only be used for API response data and not user input +func ParseRouteConfigIDInsensitively(input string) (*RouteConfigId, error) { + parser := resourceids.NewParserFromResourceIdType(&RouteConfigId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RouteConfigId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) + } + + if id.RouteConfigName, ok = input.Parsed["routeConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", input) + } + + return nil +} + +// ValidateRouteConfigID checks that 'input' can be parsed as a Route Config ID +func ValidateRouteConfigID(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 := ParseRouteConfigID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Route Config ID +func (id RouteConfigId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/gateways/%s/routeConfigs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.GatewayName, id.RouteConfigName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Route Config ID +func (id RouteConfigId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayName", "gatewayName"), + resourceids.StaticSegment("staticRouteConfigs", "routeConfigs", "routeConfigs"), + resourceids.UserSpecifiedSegment("routeConfigName", "routeConfigName"), + } +} + +// String returns a human-readable description of this Route Config ID +func (id RouteConfigId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Gateway Name: %q", id.GatewayName), + fmt.Sprintf("Route Config Name: %q", id.RouteConfigName), + } + return fmt.Sprintf("Route Config (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig_test.go new file mode 100644 index 00000000000..ec68b75666f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_routeconfig_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &RouteConfigId{} + +func TestNewRouteConfigID(t *testing.T) { + id := NewRouteConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "routeConfigName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.GatewayName != "gatewayName" { + t.Fatalf("Expected %q but got %q for Segment 'GatewayName'", id.GatewayName, "gatewayName") + } + + if id.RouteConfigName != "routeConfigName" { + t.Fatalf("Expected %q but got %q for Segment 'RouteConfigName'", id.RouteConfigName, "routeConfigName") + } +} + +func TestFormatRouteConfigID(t *testing.T) { + actual := NewRouteConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "gatewayName", "routeConfigName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs/routeConfigName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRouteConfigID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RouteConfigId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs/routeConfigName", + Expected: &RouteConfigId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + GatewayName: "gatewayName", + RouteConfigName: "routeConfigName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs/routeConfigName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRouteConfigID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.GatewayName != v.Expected.GatewayName { + t.Fatalf("Expected %q but got %q for GatewayName", v.Expected.GatewayName, actual.GatewayName) + } + + if actual.RouteConfigName != v.Expected.RouteConfigName { + t.Fatalf("Expected %q but got %q for RouteConfigName", v.Expected.RouteConfigName, actual.RouteConfigName) + } + + } +} + +func TestParseRouteConfigIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RouteConfigId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/rOuTeCoNfIgS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs/routeConfigName", + Expected: &RouteConfigId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + GatewayName: "gatewayName", + RouteConfigName: "routeConfigName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/gateways/gatewayName/routeConfigs/routeConfigName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/rOuTeCoNfIgS/rOuTeCoNfIgNaMe", + Expected: &RouteConfigId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + GatewayName: "gAtEwAyNaMe", + RouteConfigName: "rOuTeCoNfIgNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/gAtEwAyS/gAtEwAyNaMe/rOuTeCoNfIgS/rOuTeCoNfIgNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRouteConfigIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.GatewayName != v.Expected.GatewayName { + t.Fatalf("Expected %q but got %q for GatewayName", v.Expected.GatewayName, actual.GatewayName) + } + + if actual.RouteConfigName != v.Expected.RouteConfigName { + t.Fatalf("Expected %q but got %q for RouteConfigName", v.Expected.RouteConfigName, actual.RouteConfigName) + } + + } +} + +func TestSegmentsForRouteConfigId(t *testing.T) { + segments := RouteConfigId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RouteConfigId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry.go new file mode 100644 index 00000000000..ab4a91ee346 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ServiceRegistryId{}) +} + +var _ resourceids.ResourceId = &ServiceRegistryId{} + +// ServiceRegistryId is a struct representing the Resource ID for a Service Registry +type ServiceRegistryId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + ServiceRegistryName string +} + +// NewServiceRegistryID returns a new ServiceRegistryId struct +func NewServiceRegistryID(subscriptionId string, resourceGroupName string, springName string, serviceRegistryName string) ServiceRegistryId { + return ServiceRegistryId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + ServiceRegistryName: serviceRegistryName, + } +} + +// ParseServiceRegistryID parses 'input' into a ServiceRegistryId +func ParseServiceRegistryID(input string) (*ServiceRegistryId, error) { + parser := resourceids.NewParserFromResourceIdType(&ServiceRegistryId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ServiceRegistryId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseServiceRegistryIDInsensitively parses 'input' case-insensitively into a ServiceRegistryId +// note: this method should only be used for API response data and not user input +func ParseServiceRegistryIDInsensitively(input string) (*ServiceRegistryId, error) { + parser := resourceids.NewParserFromResourceIdType(&ServiceRegistryId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ServiceRegistryId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.ServiceRegistryName, ok = input.Parsed["serviceRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", input) + } + + return nil +} + +// ValidateServiceRegistryID checks that 'input' can be parsed as a Service Registry ID +func ValidateServiceRegistryID(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 := ParseServiceRegistryID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service Registry ID +func (id ServiceRegistryId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/serviceRegistries/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.ServiceRegistryName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service Registry ID +func (id ServiceRegistryId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticServiceRegistries", "serviceRegistries", "serviceRegistries"), + resourceids.UserSpecifiedSegment("serviceRegistryName", "serviceRegistryName"), + } +} + +// String returns a human-readable description of this Service Registry ID +func (id ServiceRegistryId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Service Registry Name: %q", id.ServiceRegistryName), + } + return fmt.Sprintf("Service Registry (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry_test.go new file mode 100644 index 00000000000..93fb31b0090 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_serviceregistry_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &ServiceRegistryId{} + +func TestNewServiceRegistryID(t *testing.T) { + id := NewServiceRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "serviceRegistryName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.ServiceRegistryName != "serviceRegistryName" { + t.Fatalf("Expected %q but got %q for Segment 'ServiceRegistryName'", id.ServiceRegistryName, "serviceRegistryName") + } +} + +func TestFormatServiceRegistryID(t *testing.T) { + actual := NewServiceRegistryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "serviceRegistryName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries/serviceRegistryName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseServiceRegistryID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ServiceRegistryId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries/serviceRegistryName", + Expected: &ServiceRegistryId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ServiceRegistryName: "serviceRegistryName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries/serviceRegistryName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseServiceRegistryID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ServiceRegistryName != v.Expected.ServiceRegistryName { + t.Fatalf("Expected %q but got %q for ServiceRegistryName", v.Expected.ServiceRegistryName, actual.ServiceRegistryName) + } + + } +} + +func TestParseServiceRegistryIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ServiceRegistryId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/sErViCeReGiStRiEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries/serviceRegistryName", + Expected: &ServiceRegistryId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + ServiceRegistryName: "serviceRegistryName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/serviceRegistries/serviceRegistryName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/sErViCeReGiStRiEs/sErViCeReGiStRyNaMe", + Expected: &ServiceRegistryId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + ServiceRegistryName: "sErViCeReGiStRyNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/sErViCeReGiStRiEs/sErViCeReGiStRyNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseServiceRegistryIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.ServiceRegistryName != v.Expected.ServiceRegistryName { + t.Fatalf("Expected %q but got %q for ServiceRegistryName", v.Expected.ServiceRegistryName, actual.ServiceRegistryName) + } + + } +} + +func TestSegmentsForServiceRegistryId(t *testing.T) { + segments := ServiceRegistryId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ServiceRegistryId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage.go new file mode 100644 index 00000000000..fd15260df02 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage.go @@ -0,0 +1,139 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&StorageId{}) +} + +var _ resourceids.ResourceId = &StorageId{} + +// StorageId is a struct representing the Resource ID for a Storage +type StorageId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + StorageName string +} + +// NewStorageID returns a new StorageId struct +func NewStorageID(subscriptionId string, resourceGroupName string, springName string, storageName string) StorageId { + return StorageId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + StorageName: storageName, + } +} + +// ParseStorageID parses 'input' into a StorageId +func ParseStorageID(input string) (*StorageId, error) { + parser := resourceids.NewParserFromResourceIdType(&StorageId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := StorageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseStorageIDInsensitively parses 'input' case-insensitively into a StorageId +// note: this method should only be used for API response data and not user input +func ParseStorageIDInsensitively(input string) (*StorageId, error) { + parser := resourceids.NewParserFromResourceIdType(&StorageId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := StorageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) + } + + return nil +} + +// ValidateStorageID checks that 'input' can be parsed as a Storage ID +func ValidateStorageID(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 := ParseStorageID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Storage ID +func (id StorageId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/storages/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.StorageName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Storage ID +func (id StorageId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticStorages", "storages", "storages"), + resourceids.UserSpecifiedSegment("storageName", "storageName"), + } +} + +// String returns a human-readable description of this Storage ID +func (id StorageId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Storage Name: %q", id.StorageName), + } + return fmt.Sprintf("Storage (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage_test.go new file mode 100644 index 00000000000..45e759ca305 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_storage_test.go @@ -0,0 +1,327 @@ +package appplatform + +import ( + "testing" + + "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 = &StorageId{} + +func TestNewStorageID(t *testing.T) { + id := NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "storageName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.StorageName != "storageName" { + t.Fatalf("Expected %q but got %q for Segment 'StorageName'", id.StorageName, "storageName") + } +} + +func TestFormatStorageID(t *testing.T) { + actual := NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "storageName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages/storageName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseStorageID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *StorageId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages/storageName", + Expected: &StorageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + StorageName: "storageName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages/storageName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseStorageID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.StorageName != v.Expected.StorageName { + t.Fatalf("Expected %q but got %q for StorageName", v.Expected.StorageName, actual.StorageName) + } + + } +} + +func TestParseStorageIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *StorageId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/sToRaGeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages/storageName", + Expected: &StorageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + StorageName: "storageName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/storages/storageName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/sToRaGeS/sToRaGeNaMe", + Expected: &StorageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + StorageName: "sToRaGeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/sToRaGeS/sToRaGeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseStorageIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.StorageName != v.Expected.StorageName { + t.Fatalf("Expected %q but got %q for StorageName", v.Expected.StorageName, actual.StorageName) + } + + } +} + +func TestSegmentsForStorageId(t *testing.T) { + segments := StorageId{}.Segments() + if len(segments) == 0 { + t.Fatalf("StorageId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack.go new file mode 100644 index 00000000000..6563c7f213c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&SupportedBuildPackId{}) +} + +var _ resourceids.ResourceId = &SupportedBuildPackId{} + +// SupportedBuildPackId is a struct representing the Resource ID for a Supported Build Pack +type SupportedBuildPackId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + SupportedBuildPackName string +} + +// NewSupportedBuildPackID returns a new SupportedBuildPackId struct +func NewSupportedBuildPackID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, supportedBuildPackName string) SupportedBuildPackId { + return SupportedBuildPackId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + SupportedBuildPackName: supportedBuildPackName, + } +} + +// ParseSupportedBuildPackID parses 'input' into a SupportedBuildPackId +func ParseSupportedBuildPackID(input string) (*SupportedBuildPackId, error) { + parser := resourceids.NewParserFromResourceIdType(&SupportedBuildPackId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SupportedBuildPackId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSupportedBuildPackIDInsensitively parses 'input' case-insensitively into a SupportedBuildPackId +// note: this method should only be used for API response data and not user input +func ParseSupportedBuildPackIDInsensitively(input string) (*SupportedBuildPackId, error) { + parser := resourceids.NewParserFromResourceIdType(&SupportedBuildPackId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SupportedBuildPackId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SupportedBuildPackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.SupportedBuildPackName, ok = input.Parsed["supportedBuildPackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", input) + } + + return nil +} + +// ValidateSupportedBuildPackID checks that 'input' can be parsed as a Supported Build Pack ID +func ValidateSupportedBuildPackID(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 := ParseSupportedBuildPackID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Supported Build Pack ID +func (id SupportedBuildPackId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/supportedBuildPacks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.SupportedBuildPackName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Supported Build Pack ID +func (id SupportedBuildPackId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticSupportedBuildPacks", "supportedBuildPacks", "supportedBuildPacks"), + resourceids.UserSpecifiedSegment("supportedBuildPackName", "supportedBuildPackName"), + } +} + +// String returns a human-readable description of this Supported Build Pack ID +func (id SupportedBuildPackId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Supported Build Pack Name: %q", id.SupportedBuildPackName), + } + return fmt.Sprintf("Supported Build Pack (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack_test.go new file mode 100644 index 00000000000..55550eefd46 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedbuildpack_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &SupportedBuildPackId{} + +func TestNewSupportedBuildPackID(t *testing.T) { + id := NewSupportedBuildPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "supportedBuildPackName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.SupportedBuildPackName != "supportedBuildPackName" { + t.Fatalf("Expected %q but got %q for Segment 'SupportedBuildPackName'", id.SupportedBuildPackName, "supportedBuildPackName") + } +} + +func TestFormatSupportedBuildPackID(t *testing.T) { + actual := NewSupportedBuildPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "supportedBuildPackName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks/supportedBuildPackName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSupportedBuildPackID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SupportedBuildPackId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks/supportedBuildPackName", + Expected: &SupportedBuildPackId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + SupportedBuildPackName: "supportedBuildPackName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks/supportedBuildPackName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSupportedBuildPackID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.SupportedBuildPackName != v.Expected.SupportedBuildPackName { + t.Fatalf("Expected %q but got %q for SupportedBuildPackName", v.Expected.SupportedBuildPackName, actual.SupportedBuildPackName) + } + + } +} + +func TestParseSupportedBuildPackIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SupportedBuildPackId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/sUpPoRtEdBuIlDpAcKs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks/supportedBuildPackName", + Expected: &SupportedBuildPackId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + SupportedBuildPackName: "supportedBuildPackName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedBuildPacks/supportedBuildPackName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/sUpPoRtEdBuIlDpAcKs/sUpPoRtEdBuIlDpAcKnAmE", + Expected: &SupportedBuildPackId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + SupportedBuildPackName: "sUpPoRtEdBuIlDpAcKnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/sUpPoRtEdBuIlDpAcKs/sUpPoRtEdBuIlDpAcKnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSupportedBuildPackIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.SupportedBuildPackName != v.Expected.SupportedBuildPackName { + t.Fatalf("Expected %q but got %q for SupportedBuildPackName", v.Expected.SupportedBuildPackName, actual.SupportedBuildPackName) + } + + } +} + +func TestSegmentsForSupportedBuildPackId(t *testing.T) { + segments := SupportedBuildPackId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SupportedBuildPackId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack.go new file mode 100644 index 00000000000..e8fadf42f95 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack.go @@ -0,0 +1,148 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&SupportedStackId{}) +} + +var _ resourceids.ResourceId = &SupportedStackId{} + +// SupportedStackId is a struct representing the Resource ID for a Supported Stack +type SupportedStackId struct { + SubscriptionId string + ResourceGroupName string + SpringName string + BuildServiceName string + SupportedStackName string +} + +// NewSupportedStackID returns a new SupportedStackId struct +func NewSupportedStackID(subscriptionId string, resourceGroupName string, springName string, buildServiceName string, supportedStackName string) SupportedStackId { + return SupportedStackId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpringName: springName, + BuildServiceName: buildServiceName, + SupportedStackName: supportedStackName, + } +} + +// ParseSupportedStackID parses 'input' into a SupportedStackId +func ParseSupportedStackID(input string) (*SupportedStackId, error) { + parser := resourceids.NewParserFromResourceIdType(&SupportedStackId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SupportedStackId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSupportedStackIDInsensitively parses 'input' case-insensitively into a SupportedStackId +// note: this method should only be used for API response data and not user input +func ParseSupportedStackIDInsensitively(input string) (*SupportedStackId, error) { + parser := resourceids.NewParserFromResourceIdType(&SupportedStackId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SupportedStackId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SupportedStackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) + } + + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) + } + + if id.SupportedStackName, ok = input.Parsed["supportedStackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", input) + } + + return nil +} + +// ValidateSupportedStackID checks that 'input' can be parsed as a Supported Stack ID +func ValidateSupportedStackID(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 := ParseSupportedStackID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Supported Stack ID +func (id SupportedStackId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/spring/%s/buildServices/%s/supportedStacks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpringName, id.BuildServiceName, id.SupportedStackName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Supported Stack ID +func (id SupportedStackId) 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("staticMicrosoftAppPlatform", "Microsoft.AppPlatform", "Microsoft.AppPlatform"), + resourceids.StaticSegment("staticSpring", "spring", "spring"), + resourceids.UserSpecifiedSegment("springName", "springName"), + resourceids.StaticSegment("staticBuildServices", "buildServices", "buildServices"), + resourceids.UserSpecifiedSegment("buildServiceName", "buildServiceName"), + resourceids.StaticSegment("staticSupportedStacks", "supportedStacks", "supportedStacks"), + resourceids.UserSpecifiedSegment("supportedStackName", "supportedStackName"), + } +} + +// String returns a human-readable description of this Supported Stack ID +func (id SupportedStackId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Spring Name: %q", id.SpringName), + fmt.Sprintf("Build Service Name: %q", id.BuildServiceName), + fmt.Sprintf("Supported Stack Name: %q", id.SupportedStackName), + } + return fmt.Sprintf("Supported Stack (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack_test.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack_test.go new file mode 100644 index 00000000000..9d51aa7250d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/id_supportedstack_test.go @@ -0,0 +1,372 @@ +package appplatform + +import ( + "testing" + + "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 = &SupportedStackId{} + +func TestNewSupportedStackID(t *testing.T) { + id := NewSupportedStackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "supportedStackName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SpringName != "springName" { + t.Fatalf("Expected %q but got %q for Segment 'SpringName'", id.SpringName, "springName") + } + + if id.BuildServiceName != "buildServiceName" { + t.Fatalf("Expected %q but got %q for Segment 'BuildServiceName'", id.BuildServiceName, "buildServiceName") + } + + if id.SupportedStackName != "supportedStackName" { + t.Fatalf("Expected %q but got %q for Segment 'SupportedStackName'", id.SupportedStackName, "supportedStackName") + } +} + +func TestFormatSupportedStackID(t *testing.T) { + actual := NewSupportedStackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "springName", "buildServiceName", "supportedStackName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks/supportedStackName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSupportedStackID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SupportedStackId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks/supportedStackName", + Expected: &SupportedStackId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + SupportedStackName: "supportedStackName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks/supportedStackName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSupportedStackID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.SupportedStackName != v.Expected.SupportedStackName { + t.Fatalf("Expected %q but got %q for SupportedStackName", v.Expected.SupportedStackName, actual.SupportedStackName) + } + + } +} + +func TestParseSupportedStackIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SupportedStackId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/sUpPoRtEdStAcKs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks/supportedStackName", + Expected: &SupportedStackId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SpringName: "springName", + BuildServiceName: "buildServiceName", + SupportedStackName: "supportedStackName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.AppPlatform/spring/springName/buildServices/buildServiceName/supportedStacks/supportedStackName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/sUpPoRtEdStAcKs/sUpPoRtEdStAcKnAmE", + Expected: &SupportedStackId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SpringName: "sPrInGnAmE", + BuildServiceName: "bUiLdSeRvIcEnAmE", + SupportedStackName: "sUpPoRtEdStAcKnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.aPpPlAtFoRm/sPrInG/sPrInGnAmE/bUiLdSeRvIcEs/bUiLdSeRvIcEnAmE/sUpPoRtEdStAcKs/sUpPoRtEdStAcKnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSupportedStackIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", 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.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SpringName != v.Expected.SpringName { + t.Fatalf("Expected %q but got %q for SpringName", v.Expected.SpringName, actual.SpringName) + } + + if actual.BuildServiceName != v.Expected.BuildServiceName { + t.Fatalf("Expected %q but got %q for BuildServiceName", v.Expected.BuildServiceName, actual.BuildServiceName) + } + + if actual.SupportedStackName != v.Expected.SupportedStackName { + t.Fatalf("Expected %q but got %q for SupportedStackName", v.Expected.SupportedStackName, actual.SupportedStackName) + } + + } +} + +func TestSegmentsForSupportedStackId(t *testing.T) { + segments := SupportedStackId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SupportedStackId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainscreateorupdate.go new file mode 100644 index 00000000000..376a69415d2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ApiPortalCustomDomainsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ApiPortalCustomDomainResource +} + +// ApiPortalCustomDomainsCreateOrUpdate ... +func (c AppPlatformClient) ApiPortalCustomDomainsCreateOrUpdate(ctx context.Context, id ApiPortalDomainId, input ApiPortalCustomDomainResource) (result ApiPortalCustomDomainsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApiPortalCustomDomainsCreateOrUpdateThenPoll performs ApiPortalCustomDomainsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ApiPortalCustomDomainsCreateOrUpdateThenPoll(ctx context.Context, id ApiPortalDomainId, input ApiPortalCustomDomainResource) error { + result, err := c.ApiPortalCustomDomainsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApiPortalCustomDomainsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApiPortalCustomDomainsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsdelete.go new file mode 100644 index 00000000000..d3a53d5848e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 ApiPortalCustomDomainsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApiPortalCustomDomainsDelete ... +func (c AppPlatformClient) ApiPortalCustomDomainsDelete(ctx context.Context, id ApiPortalDomainId) (result ApiPortalCustomDomainsDeleteOperationResponse, 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 +} + +// ApiPortalCustomDomainsDeleteThenPoll performs ApiPortalCustomDomainsDelete then polls until it's completed +func (c AppPlatformClient) ApiPortalCustomDomainsDeleteThenPoll(ctx context.Context, id ApiPortalDomainId) error { + result, err := c.ApiPortalCustomDomainsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ApiPortalCustomDomainsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApiPortalCustomDomainsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsget.go new file mode 100644 index 00000000000..ee2bbd322c2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ApiPortalCustomDomainsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiPortalCustomDomainResource +} + +// ApiPortalCustomDomainsGet ... +func (c AppPlatformClient) ApiPortalCustomDomainsGet(ctx context.Context, id ApiPortalDomainId) (result ApiPortalCustomDomainsGetOperationResponse, 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 + } + + var model ApiPortalCustomDomainResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainslist.go new file mode 100644 index 00000000000..82141432efe --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalcustomdomainslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 ApiPortalCustomDomainsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiPortalCustomDomainResource +} + +type ApiPortalCustomDomainsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApiPortalCustomDomainResource +} + +type ApiPortalCustomDomainsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ApiPortalCustomDomainsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ApiPortalCustomDomainsList ... +func (c AppPlatformClient) ApiPortalCustomDomainsList(ctx context.Context, id ApiPortalId) (result ApiPortalCustomDomainsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ApiPortalCustomDomainsListCustomPager{}, + Path: fmt.Sprintf("%s/domains", 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 *[]ApiPortalCustomDomainResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApiPortalCustomDomainsListComplete retrieves all the results into a single object +func (c AppPlatformClient) ApiPortalCustomDomainsListComplete(ctx context.Context, id ApiPortalId) (ApiPortalCustomDomainsListCompleteResult, error) { + return c.ApiPortalCustomDomainsListCompleteMatchingPredicate(ctx, id, ApiPortalCustomDomainResourceOperationPredicate{}) +} + +// ApiPortalCustomDomainsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ApiPortalCustomDomainsListCompleteMatchingPredicate(ctx context.Context, id ApiPortalId, predicate ApiPortalCustomDomainResourceOperationPredicate) (result ApiPortalCustomDomainsListCompleteResult, err error) { + items := make([]ApiPortalCustomDomainResource, 0) + + resp, err := c.ApiPortalCustomDomainsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ApiPortalCustomDomainsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalscreateorupdate.go new file mode 100644 index 00000000000..a9f8b79f862 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ApiPortalsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ApiPortalResource +} + +// ApiPortalsCreateOrUpdate ... +func (c AppPlatformClient) ApiPortalsCreateOrUpdate(ctx context.Context, id ApiPortalId, input ApiPortalResource) (result ApiPortalsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApiPortalsCreateOrUpdateThenPoll performs ApiPortalsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ApiPortalsCreateOrUpdateThenPoll(ctx context.Context, id ApiPortalId, input ApiPortalResource) error { + result, err := c.ApiPortalsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApiPortalsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApiPortalsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsdelete.go new file mode 100644 index 00000000000..3976b7c230b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 ApiPortalsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApiPortalsDelete ... +func (c AppPlatformClient) ApiPortalsDelete(ctx context.Context, id ApiPortalId) (result ApiPortalsDeleteOperationResponse, 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 +} + +// ApiPortalsDeleteThenPoll performs ApiPortalsDelete then polls until it's completed +func (c AppPlatformClient) ApiPortalsDeleteThenPoll(ctx context.Context, id ApiPortalId) error { + result, err := c.ApiPortalsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ApiPortalsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApiPortalsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsget.go new file mode 100644 index 00000000000..9dcaaa30ad8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ApiPortalsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiPortalResource +} + +// ApiPortalsGet ... +func (c AppPlatformClient) ApiPortalsGet(ctx context.Context, id ApiPortalId) (result ApiPortalsGetOperationResponse, 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 + } + + var model ApiPortalResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalslist.go new file mode 100644 index 00000000000..505576f3290 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ApiPortalsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiPortalResource +} + +type ApiPortalsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApiPortalResource +} + +type ApiPortalsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ApiPortalsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ApiPortalsList ... +func (c AppPlatformClient) ApiPortalsList(ctx context.Context, id commonids.SpringCloudServiceId) (result ApiPortalsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ApiPortalsListCustomPager{}, + Path: fmt.Sprintf("%s/apiPortals", 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 *[]ApiPortalResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApiPortalsListComplete retrieves all the results into a single object +func (c AppPlatformClient) ApiPortalsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ApiPortalsListCompleteResult, error) { + return c.ApiPortalsListCompleteMatchingPredicate(ctx, id, ApiPortalResourceOperationPredicate{}) +} + +// ApiPortalsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ApiPortalsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ApiPortalResourceOperationPredicate) (result ApiPortalsListCompleteResult, err error) { + items := make([]ApiPortalResource, 0) + + resp, err := c.ApiPortalsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ApiPortalsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsvalidatedomain.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsvalidatedomain.go new file mode 100644 index 00000000000..18b39e239aa --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apiportalsvalidatedomain.go @@ -0,0 +1,58 @@ +package appplatform + +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 ApiPortalsValidateDomainOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CustomDomainValidateResult +} + +// ApiPortalsValidateDomain ... +func (c AppPlatformClient) ApiPortalsValidateDomain(ctx context.Context, id ApiPortalId, input CustomDomainValidatePayload) (result ApiPortalsValidateDomainOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateDomain", 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 + } + + var model CustomDomainValidateResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmscreateorupdate.go new file mode 100644 index 00000000000..2086e1c0238 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ApmsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ApmResource +} + +// ApmsCreateOrUpdate ... +func (c AppPlatformClient) ApmsCreateOrUpdate(ctx context.Context, id ApmId, input ApmResource) (result ApmsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApmsCreateOrUpdateThenPoll performs ApmsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ApmsCreateOrUpdateThenPoll(ctx context.Context, id ApmId, input ApmResource) error { + result, err := c.ApmsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApmsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApmsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsdelete.go new file mode 100644 index 00000000000..049fd2144ff --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 ApmsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApmsDelete ... +func (c AppPlatformClient) ApmsDelete(ctx context.Context, id ApmId) (result ApmsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// ApmsDeleteThenPoll performs ApmsDelete then polls until it's completed +func (c AppPlatformClient) ApmsDeleteThenPoll(ctx context.Context, id ApmId) error { + result, err := c.ApmsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ApmsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApmsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsget.go new file mode 100644 index 00000000000..f467f8eaaf3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ApmsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApmResource +} + +// ApmsGet ... +func (c AppPlatformClient) ApmsGet(ctx context.Context, id ApmId) (result ApmsGetOperationResponse, 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 + } + + var model ApmResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslist.go new file mode 100644 index 00000000000..bbf0956d014 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ApmsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApmResource +} + +type ApmsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApmResource +} + +type ApmsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ApmsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ApmsList ... +func (c AppPlatformClient) ApmsList(ctx context.Context, id commonids.SpringCloudServiceId) (result ApmsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ApmsListCustomPager{}, + Path: fmt.Sprintf("%s/apms", 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 *[]ApmResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApmsListComplete retrieves all the results into a single object +func (c AppPlatformClient) ApmsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ApmsListCompleteResult, error) { + return c.ApmsListCompleteMatchingPredicate(ctx, id, ApmResourceOperationPredicate{}) +} + +// ApmsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ApmsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ApmResourceOperationPredicate) (result ApmsListCompleteResult, err error) { + items := make([]ApmResource, 0) + + resp, err := c.ApmsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ApmsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslistsecretkeys.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslistsecretkeys.go new file mode 100644 index 00000000000..5bd8219bd7a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_apmslistsecretkeys.go @@ -0,0 +1,54 @@ +package appplatform + +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 ApmsListSecretKeysOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApmSecretKeys +} + +// ApmsListSecretKeys ... +func (c AppPlatformClient) ApmsListSecretKeys(ctx context.Context, id ApmId) (result ApmsListSecretKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecretKeys", 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 + } + + var model ApmSecretKeys + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorscreateorupdate.go new file mode 100644 index 00000000000..38315abf3fa --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ApplicationAcceleratorsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationAcceleratorResource +} + +// ApplicationAcceleratorsCreateOrUpdate ... +func (c AppPlatformClient) ApplicationAcceleratorsCreateOrUpdate(ctx context.Context, id ApplicationAcceleratorId, input ApplicationAcceleratorResource) (result ApplicationAcceleratorsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApplicationAcceleratorsCreateOrUpdateThenPoll performs ApplicationAcceleratorsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ApplicationAcceleratorsCreateOrUpdateThenPoll(ctx context.Context, id ApplicationAcceleratorId, input ApplicationAcceleratorResource) error { + result, err := c.ApplicationAcceleratorsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApplicationAcceleratorsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplicationAcceleratorsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsdelete.go new file mode 100644 index 00000000000..1c250645da8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 ApplicationAcceleratorsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApplicationAcceleratorsDelete ... +func (c AppPlatformClient) ApplicationAcceleratorsDelete(ctx context.Context, id ApplicationAcceleratorId) (result ApplicationAcceleratorsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// ApplicationAcceleratorsDeleteThenPoll performs ApplicationAcceleratorsDelete then polls until it's completed +func (c AppPlatformClient) ApplicationAcceleratorsDeleteThenPoll(ctx context.Context, id ApplicationAcceleratorId) error { + result, err := c.ApplicationAcceleratorsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ApplicationAcceleratorsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplicationAcceleratorsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsget.go new file mode 100644 index 00000000000..4b328230326 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ApplicationAcceleratorsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationAcceleratorResource +} + +// ApplicationAcceleratorsGet ... +func (c AppPlatformClient) ApplicationAcceleratorsGet(ctx context.Context, id ApplicationAcceleratorId) (result ApplicationAcceleratorsGetOperationResponse, 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 + } + + var model ApplicationAcceleratorResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorslist.go new file mode 100644 index 00000000000..3d0057098ed --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationacceleratorslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ApplicationAcceleratorsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationAcceleratorResource +} + +type ApplicationAcceleratorsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApplicationAcceleratorResource +} + +type ApplicationAcceleratorsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ApplicationAcceleratorsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ApplicationAcceleratorsList ... +func (c AppPlatformClient) ApplicationAcceleratorsList(ctx context.Context, id commonids.SpringCloudServiceId) (result ApplicationAcceleratorsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ApplicationAcceleratorsListCustomPager{}, + Path: fmt.Sprintf("%s/applicationAccelerators", 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 *[]ApplicationAcceleratorResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApplicationAcceleratorsListComplete retrieves all the results into a single object +func (c AppPlatformClient) ApplicationAcceleratorsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ApplicationAcceleratorsListCompleteResult, error) { + return c.ApplicationAcceleratorsListCompleteMatchingPredicate(ctx, id, ApplicationAcceleratorResourceOperationPredicate{}) +} + +// ApplicationAcceleratorsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ApplicationAcceleratorsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ApplicationAcceleratorResourceOperationPredicate) (result ApplicationAcceleratorsListCompleteResult, err error) { + items := make([]ApplicationAcceleratorResource, 0) + + resp, err := c.ApplicationAcceleratorsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ApplicationAcceleratorsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewscreateorupdate.go new file mode 100644 index 00000000000..c6aed393cc2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ApplicationLiveViewsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationLiveViewResource +} + +// ApplicationLiveViewsCreateOrUpdate ... +func (c AppPlatformClient) ApplicationLiveViewsCreateOrUpdate(ctx context.Context, id ApplicationLiveViewId, input ApplicationLiveViewResource) (result ApplicationLiveViewsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApplicationLiveViewsCreateOrUpdateThenPoll performs ApplicationLiveViewsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ApplicationLiveViewsCreateOrUpdateThenPoll(ctx context.Context, id ApplicationLiveViewId, input ApplicationLiveViewResource) error { + result, err := c.ApplicationLiveViewsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApplicationLiveViewsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplicationLiveViewsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsdelete.go new file mode 100644 index 00000000000..1e95cd905a0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 ApplicationLiveViewsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApplicationLiveViewsDelete ... +func (c AppPlatformClient) ApplicationLiveViewsDelete(ctx context.Context, id ApplicationLiveViewId) (result ApplicationLiveViewsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// ApplicationLiveViewsDeleteThenPoll performs ApplicationLiveViewsDelete then polls until it's completed +func (c AppPlatformClient) ApplicationLiveViewsDeleteThenPoll(ctx context.Context, id ApplicationLiveViewId) error { + result, err := c.ApplicationLiveViewsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ApplicationLiveViewsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplicationLiveViewsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsget.go new file mode 100644 index 00000000000..2830fd1fdba --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ApplicationLiveViewsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationLiveViewResource +} + +// ApplicationLiveViewsGet ... +func (c AppPlatformClient) ApplicationLiveViewsGet(ctx context.Context, id ApplicationLiveViewId) (result ApplicationLiveViewsGetOperationResponse, 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 + } + + var model ApplicationLiveViewResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewslist.go new file mode 100644 index 00000000000..7b278500e1c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_applicationliveviewslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ApplicationLiveViewsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationLiveViewResource +} + +type ApplicationLiveViewsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApplicationLiveViewResource +} + +type ApplicationLiveViewsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ApplicationLiveViewsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ApplicationLiveViewsList ... +func (c AppPlatformClient) ApplicationLiveViewsList(ctx context.Context, id commonids.SpringCloudServiceId) (result ApplicationLiveViewsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ApplicationLiveViewsListCustomPager{}, + Path: fmt.Sprintf("%s/applicationLiveViews", 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 *[]ApplicationLiveViewResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApplicationLiveViewsListComplete retrieves all the results into a single object +func (c AppPlatformClient) ApplicationLiveViewsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ApplicationLiveViewsListCompleteResult, error) { + return c.ApplicationLiveViewsListCompleteMatchingPredicate(ctx, id, ApplicationLiveViewResourceOperationPredicate{}) +} + +// ApplicationLiveViewsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ApplicationLiveViewsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ApplicationLiveViewResourceOperationPredicate) (result ApplicationLiveViewsListCompleteResult, err error) { + items := make([]ApplicationLiveViewResource, 0) + + resp, err := c.ApplicationLiveViewsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ApplicationLiveViewsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appscreateorupdate.go new file mode 100644 index 00000000000..5887faf05c6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appscreateorupdate.go @@ -0,0 +1,76 @@ +package appplatform + +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 AppsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AppResource +} + +// AppsCreateOrUpdate ... +func (c AppPlatformClient) AppsCreateOrUpdate(ctx context.Context, id AppId, input AppResource) (result AppsCreateOrUpdateOperationResponse, 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 +} + +// AppsCreateOrUpdateThenPoll performs AppsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) AppsCreateOrUpdateThenPoll(ctx context.Context, id AppId, input AppResource) error { + result, err := c.AppsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AppsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AppsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsdelete.go new file mode 100644 index 00000000000..79fa43f0e42 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 AppsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AppsDelete ... +func (c AppPlatformClient) AppsDelete(ctx context.Context, id AppId) (result AppsDeleteOperationResponse, 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 +} + +// AppsDeleteThenPoll performs AppsDelete then polls until it's completed +func (c AppPlatformClient) AppsDeleteThenPoll(ctx context.Context, id AppId) error { + result, err := c.AppsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AppsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AppsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsget.go new file mode 100644 index 00000000000..3724e37ca47 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsget.go @@ -0,0 +1,83 @@ +package appplatform + +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 AppsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AppResource +} + +type AppsGetOperationOptions struct { + SyncStatus *string +} + +func DefaultAppsGetOperationOptions() AppsGetOperationOptions { + return AppsGetOperationOptions{} +} + +func (o AppsGetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o AppsGetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o AppsGetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SyncStatus != nil { + out.Append("syncStatus", fmt.Sprintf("%v", *o.SyncStatus)) + } + return &out +} + +// AppsGet ... +func (c AppPlatformClient) AppsGet(ctx context.Context, id AppId, options AppsGetOperationOptions) (result AppsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 + } + + var model AppResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsgetresourceuploadurl.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsgetresourceuploadurl.go new file mode 100644 index 00000000000..c309409d12e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsgetresourceuploadurl.go @@ -0,0 +1,54 @@ +package appplatform + +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 AppsGetResourceUploadURLOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResourceUploadDefinition +} + +// AppsGetResourceUploadURL ... +func (c AppPlatformClient) AppsGetResourceUploadURL(ctx context.Context, id AppId) (result AppsGetResourceUploadURLOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getResourceUploadUrl", 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 + } + + var model ResourceUploadDefinition + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appslist.go new file mode 100644 index 00000000000..5c0889a6c8e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 AppsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AppResource +} + +type AppsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AppResource +} + +type AppsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *AppsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// AppsList ... +func (c AppPlatformClient) AppsList(ctx context.Context, id commonids.SpringCloudServiceId) (result AppsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &AppsListCustomPager{}, + Path: fmt.Sprintf("%s/apps", 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 *[]AppResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// AppsListComplete retrieves all the results into a single object +func (c AppPlatformClient) AppsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (AppsListCompleteResult, error) { + return c.AppsListCompleteMatchingPredicate(ctx, id, AppResourceOperationPredicate{}) +} + +// AppsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) AppsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate AppResourceOperationPredicate) (result AppsListCompleteResult, err error) { + items := make([]AppResource, 0) + + resp, err := c.AppsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = AppsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appssetactivedeployments.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appssetactivedeployments.go new file mode 100644 index 00000000000..823b8439abf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appssetactivedeployments.go @@ -0,0 +1,75 @@ +package appplatform + +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 AppsSetActiveDeploymentsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AppResource +} + +// AppsSetActiveDeployments ... +func (c AppPlatformClient) AppsSetActiveDeployments(ctx context.Context, id AppId, input ActiveDeploymentCollection) (result AppsSetActiveDeploymentsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/setActiveDeployments", 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 +} + +// AppsSetActiveDeploymentsThenPoll performs AppsSetActiveDeployments then polls until it's completed +func (c AppPlatformClient) AppsSetActiveDeploymentsThenPoll(ctx context.Context, id AppId, input ActiveDeploymentCollection) error { + result, err := c.AppsSetActiveDeployments(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AppsSetActiveDeployments: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AppsSetActiveDeployments: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsupdate.go new file mode 100644 index 00000000000..54ec6b79dba --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 AppsUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AppResource +} + +// AppsUpdate ... +func (c AppPlatformClient) AppsUpdate(ctx context.Context, id AppId, input AppResource) (result AppsUpdateOperationResponse, 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 +} + +// AppsUpdateThenPoll performs AppsUpdate then polls until it's completed +func (c AppPlatformClient) AppsUpdateThenPoll(ctx context.Context, id AppId, input AppResource) error { + result, err := c.AppsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AppsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AppsUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsvalidatedomain.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsvalidatedomain.go new file mode 100644 index 00000000000..2e32bcfc251 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_appsvalidatedomain.go @@ -0,0 +1,58 @@ +package appplatform + +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 AppsValidateDomainOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CustomDomainValidateResult +} + +// AppsValidateDomain ... +func (c AppPlatformClient) AppsValidateDomain(ctx context.Context, id AppId, input CustomDomainValidatePayload) (result AppsValidateDomainOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateDomain", 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 + } + + var model CustomDomainValidateResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingscreateorupdate.go new file mode 100644 index 00000000000..25efbf8a676 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingscreateorupdate.go @@ -0,0 +1,76 @@ +package appplatform + +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 BindingsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BindingResource +} + +// BindingsCreateOrUpdate ... +func (c AppPlatformClient) BindingsCreateOrUpdate(ctx context.Context, id BindingId, input BindingResource) (result BindingsCreateOrUpdateOperationResponse, 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 +} + +// BindingsCreateOrUpdateThenPoll performs BindingsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) BindingsCreateOrUpdateThenPoll(ctx context.Context, id BindingId, input BindingResource) error { + result, err := c.BindingsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BindingsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BindingsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsdelete.go new file mode 100644 index 00000000000..d300c757a84 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 BindingsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BindingsDelete ... +func (c AppPlatformClient) BindingsDelete(ctx context.Context, id BindingId) (result BindingsDeleteOperationResponse, 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 +} + +// BindingsDeleteThenPoll performs BindingsDelete then polls until it's completed +func (c AppPlatformClient) BindingsDeleteThenPoll(ctx context.Context, id BindingId) error { + result, err := c.BindingsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing BindingsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BindingsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsget.go new file mode 100644 index 00000000000..fd7934dd484 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 BindingsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BindingResource +} + +// BindingsGet ... +func (c AppPlatformClient) BindingsGet(ctx context.Context, id BindingId) (result BindingsGetOperationResponse, 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 + } + + var model BindingResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingslist.go new file mode 100644 index 00000000000..8bda68a1115 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 BindingsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BindingResource +} + +type BindingsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []BindingResource +} + +type BindingsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BindingsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BindingsList ... +func (c AppPlatformClient) BindingsList(ctx context.Context, id AppId) (result BindingsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BindingsListCustomPager{}, + Path: fmt.Sprintf("%s/bindings", 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 *[]BindingResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BindingsListComplete retrieves all the results into a single object +func (c AppPlatformClient) BindingsListComplete(ctx context.Context, id AppId) (BindingsListCompleteResult, error) { + return c.BindingsListCompleteMatchingPredicate(ctx, id, BindingResourceOperationPredicate{}) +} + +// BindingsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BindingsListCompleteMatchingPredicate(ctx context.Context, id AppId, predicate BindingResourceOperationPredicate) (result BindingsListCompleteResult, err error) { + items := make([]BindingResource, 0) + + resp, err := c.BindingsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BindingsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsupdate.go new file mode 100644 index 00000000000..12588e10ee7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_bindingsupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 BindingsUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BindingResource +} + +// BindingsUpdate ... +func (c AppPlatformClient) BindingsUpdate(ctx context.Context, id BindingId, input BindingResource) (result BindingsUpdateOperationResponse, 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 +} + +// BindingsUpdateThenPoll performs BindingsUpdate then polls until it's completed +func (c AppPlatformClient) BindingsUpdateThenPoll(ctx context.Context, id BindingId, input BindingResource) error { + result, err := c.BindingsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BindingsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BindingsUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingcreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingcreateorupdate.go new file mode 100644 index 00000000000..cfff06a3cf8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingcreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 BuildpackBindingCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BuildpackBindingResource +} + +// BuildpackBindingCreateOrUpdate ... +func (c AppPlatformClient) BuildpackBindingCreateOrUpdate(ctx context.Context, id BuildPackBindingId, input BuildpackBindingResource) (result BuildpackBindingCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BuildpackBindingCreateOrUpdateThenPoll performs BuildpackBindingCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) BuildpackBindingCreateOrUpdateThenPoll(ctx context.Context, id BuildPackBindingId, input BuildpackBindingResource) error { + result, err := c.BuildpackBindingCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BuildpackBindingCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildpackBindingCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingdelete.go new file mode 100644 index 00000000000..59cb3110b06 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 BuildpackBindingDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BuildpackBindingDelete ... +func (c AppPlatformClient) BuildpackBindingDelete(ctx context.Context, id BuildPackBindingId) (result BuildpackBindingDeleteOperationResponse, 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 +} + +// BuildpackBindingDeleteThenPoll performs BuildpackBindingDelete then polls until it's completed +func (c AppPlatformClient) BuildpackBindingDeleteThenPoll(ctx context.Context, id BuildPackBindingId) error { + result, err := c.BuildpackBindingDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing BuildpackBindingDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildpackBindingDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingget.go new file mode 100644 index 00000000000..9cb2a5754d5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindingget.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildpackBindingGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BuildpackBindingResource +} + +// BuildpackBindingGet ... +func (c AppPlatformClient) BuildpackBindingGet(ctx context.Context, id BuildPackBindingId) (result BuildpackBindingGetOperationResponse, 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 + } + + var model BuildpackBindingResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglist.go new file mode 100644 index 00000000000..d530a1a1886 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglist.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildpackBindingListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BuildpackBindingResource +} + +type BuildpackBindingListCompleteResult struct { + LatestHttpResponse *http.Response + Items []BuildpackBindingResource +} + +type BuildpackBindingListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildpackBindingListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildpackBindingList ... +func (c AppPlatformClient) BuildpackBindingList(ctx context.Context, id BuilderId) (result BuildpackBindingListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildpackBindingListCustomPager{}, + Path: fmt.Sprintf("%s/buildPackBindings", 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 *[]BuildpackBindingResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildpackBindingListComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildpackBindingListComplete(ctx context.Context, id BuilderId) (BuildpackBindingListCompleteResult, error) { + return c.BuildpackBindingListCompleteMatchingPredicate(ctx, id, BuildpackBindingResourceOperationPredicate{}) +} + +// BuildpackBindingListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildpackBindingListCompleteMatchingPredicate(ctx context.Context, id BuilderId, predicate BuildpackBindingResourceOperationPredicate) (result BuildpackBindingListCompleteResult, err error) { + items := make([]BuildpackBindingResource, 0) + + resp, err := c.BuildpackBindingList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildpackBindingListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglistforcluster.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglistforcluster.go new file mode 100644 index 00000000000..ed9ca0bbdc6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildpackbindinglistforcluster.go @@ -0,0 +1,106 @@ +package appplatform + +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 BuildpackBindingListForClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BuildpackBindingResource +} + +type BuildpackBindingListForClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []BuildpackBindingResource +} + +type BuildpackBindingListForClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildpackBindingListForClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildpackBindingListForCluster ... +func (c AppPlatformClient) BuildpackBindingListForCluster(ctx context.Context, id commonids.SpringCloudServiceId) (result BuildpackBindingListForClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildpackBindingListForClusterCustomPager{}, + Path: fmt.Sprintf("%s/buildPackBindings", 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 *[]BuildpackBindingResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildpackBindingListForClusterComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildpackBindingListForClusterComplete(ctx context.Context, id commonids.SpringCloudServiceId) (BuildpackBindingListForClusterCompleteResult, error) { + return c.BuildpackBindingListForClusterCompleteMatchingPredicate(ctx, id, BuildpackBindingResourceOperationPredicate{}) +} + +// BuildpackBindingListForClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildpackBindingListForClusterCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate BuildpackBindingResourceOperationPredicate) (result BuildpackBindingListForClusterCompleteResult, err error) { + items := make([]BuildpackBindingResource, 0) + + resp, err := c.BuildpackBindingListForCluster(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildpackBindingListForClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolget.go new file mode 100644 index 00000000000..5c09fcc1136 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolget.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceAgentPoolGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BuildServiceAgentPoolResource +} + +// BuildServiceAgentPoolGet ... +func (c AppPlatformClient) BuildServiceAgentPoolGet(ctx context.Context, id AgentPoolId) (result BuildServiceAgentPoolGetOperationResponse, 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 + } + + var model BuildServiceAgentPoolResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoollist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoollist.go new file mode 100644 index 00000000000..c387e88ca55 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoollist.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildServiceAgentPoolListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BuildServiceAgentPoolResource +} + +type BuildServiceAgentPoolListCompleteResult struct { + LatestHttpResponse *http.Response + Items []BuildServiceAgentPoolResource +} + +type BuildServiceAgentPoolListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceAgentPoolListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceAgentPoolList ... +func (c AppPlatformClient) BuildServiceAgentPoolList(ctx context.Context, id BuildServiceId) (result BuildServiceAgentPoolListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceAgentPoolListCustomPager{}, + Path: fmt.Sprintf("%s/agentPools", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]BuildServiceAgentPoolResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceAgentPoolListComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceAgentPoolListComplete(ctx context.Context, id BuildServiceId) (BuildServiceAgentPoolListCompleteResult, error) { + return c.BuildServiceAgentPoolListCompleteMatchingPredicate(ctx, id, BuildServiceAgentPoolResourceOperationPredicate{}) +} + +// BuildServiceAgentPoolListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceAgentPoolListCompleteMatchingPredicate(ctx context.Context, id BuildServiceId, predicate BuildServiceAgentPoolResourceOperationPredicate) (result BuildServiceAgentPoolListCompleteResult, err error) { + items := make([]BuildServiceAgentPoolResource, 0) + + resp, err := c.BuildServiceAgentPoolList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceAgentPoolListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolupdateput.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolupdateput.go new file mode 100644 index 00000000000..a3e68834b17 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildserviceagentpoolupdateput.go @@ -0,0 +1,75 @@ +package appplatform + +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 BuildServiceAgentPoolUpdatePutOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BuildServiceAgentPoolResource +} + +// BuildServiceAgentPoolUpdatePut ... +func (c AppPlatformClient) BuildServiceAgentPoolUpdatePut(ctx context.Context, id AgentPoolId, input BuildServiceAgentPoolResource) (result BuildServiceAgentPoolUpdatePutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BuildServiceAgentPoolUpdatePutThenPoll performs BuildServiceAgentPoolUpdatePut then polls until it's completed +func (c AppPlatformClient) BuildServiceAgentPoolUpdatePutThenPoll(ctx context.Context, id AgentPoolId, input BuildServiceAgentPoolResource) error { + result, err := c.BuildServiceAgentPoolUpdatePut(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BuildServiceAgentPoolUpdatePut: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildServiceAgentPoolUpdatePut: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuildercreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuildercreateorupdate.go new file mode 100644 index 00000000000..1d6e51d1494 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuildercreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 BuildServiceBuilderCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BuilderResource +} + +// BuildServiceBuilderCreateOrUpdate ... +func (c AppPlatformClient) BuildServiceBuilderCreateOrUpdate(ctx context.Context, id BuilderId, input BuilderResource) (result BuildServiceBuilderCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BuildServiceBuilderCreateOrUpdateThenPoll performs BuildServiceBuilderCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) BuildServiceBuilderCreateOrUpdateThenPoll(ctx context.Context, id BuilderId, input BuilderResource) error { + result, err := c.BuildServiceBuilderCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BuildServiceBuilderCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildServiceBuilderCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderdelete.go new file mode 100644 index 00000000000..9fe5316588a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 BuildServiceBuilderDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BuildServiceBuilderDelete ... +func (c AppPlatformClient) BuildServiceBuilderDelete(ctx context.Context, id BuilderId) (result BuildServiceBuilderDeleteOperationResponse, 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 +} + +// BuildServiceBuilderDeleteThenPoll performs BuildServiceBuilderDelete then polls until it's completed +func (c AppPlatformClient) BuildServiceBuilderDeleteThenPoll(ctx context.Context, id BuilderId) error { + result, err := c.BuildServiceBuilderDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing BuildServiceBuilderDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildServiceBuilderDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderget.go new file mode 100644 index 00000000000..fc88a1423e7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderget.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceBuilderGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BuilderResource +} + +// BuildServiceBuilderGet ... +func (c AppPlatformClient) BuildServiceBuilderGet(ctx context.Context, id BuilderId) (result BuildServiceBuilderGetOperationResponse, 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 + } + + var model BuilderResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlist.go new file mode 100644 index 00000000000..df5830f87f3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlist.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildServiceBuilderListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BuilderResource +} + +type BuildServiceBuilderListCompleteResult struct { + LatestHttpResponse *http.Response + Items []BuilderResource +} + +type BuildServiceBuilderListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceBuilderListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceBuilderList ... +func (c AppPlatformClient) BuildServiceBuilderList(ctx context.Context, id BuildServiceId) (result BuildServiceBuilderListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceBuilderListCustomPager{}, + Path: fmt.Sprintf("%s/builders", 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 *[]BuilderResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceBuilderListComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceBuilderListComplete(ctx context.Context, id BuildServiceId) (BuildServiceBuilderListCompleteResult, error) { + return c.BuildServiceBuilderListCompleteMatchingPredicate(ctx, id, BuilderResourceOperationPredicate{}) +} + +// BuildServiceBuilderListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceBuilderListCompleteMatchingPredicate(ctx context.Context, id BuildServiceId, predicate BuilderResourceOperationPredicate) (result BuildServiceBuilderListCompleteResult, err error) { + items := make([]BuilderResource, 0) + + resp, err := c.BuildServiceBuilderList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceBuilderListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlistdeployments.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlistdeployments.go new file mode 100644 index 00000000000..28662e9243e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicebuilderlistdeployments.go @@ -0,0 +1,54 @@ +package appplatform + +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 BuildServiceBuilderListDeploymentsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DeploymentList +} + +// BuildServiceBuilderListDeployments ... +func (c AppPlatformClient) BuildServiceBuilderListDeployments(ctx context.Context, id BuilderId) (result BuildServiceBuilderListDeploymentsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listUsingDeployments", 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 + } + + var model DeploymentList + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdate.go new file mode 100644 index 00000000000..fa41028b626 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 BuildServiceCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BuildService +} + +// BuildServiceCreateOrUpdate ... +func (c AppPlatformClient) BuildServiceCreateOrUpdate(ctx context.Context, id BuildServiceId, input BuildService) (result BuildServiceCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BuildServiceCreateOrUpdateThenPoll performs BuildServiceCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) BuildServiceCreateOrUpdateThenPoll(ctx context.Context, id BuildServiceId, input BuildService) error { + result, err := c.BuildServiceCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BuildServiceCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildServiceCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdatebuild.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdatebuild.go new file mode 100644 index 00000000000..c8b22694446 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicecreateorupdatebuild.go @@ -0,0 +1,58 @@ +package appplatform + +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 BuildServiceCreateOrUpdateBuildOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Build +} + +// BuildServiceCreateOrUpdateBuild ... +func (c AppPlatformClient) BuildServiceCreateOrUpdateBuild(ctx context.Context, id BuildId, input Build) (result BuildServiceCreateOrUpdateBuildOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Build + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicedeletebuild.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicedeletebuild.go new file mode 100644 index 00000000000..d6c44c46370 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicedeletebuild.go @@ -0,0 +1,70 @@ +package appplatform + +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 BuildServiceDeleteBuildOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BuildServiceDeleteBuild ... +func (c AppPlatformClient) BuildServiceDeleteBuild(ctx context.Context, id BuildId) (result BuildServiceDeleteBuildOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// BuildServiceDeleteBuildThenPoll performs BuildServiceDeleteBuild then polls until it's completed +func (c AppPlatformClient) BuildServiceDeleteBuildThenPoll(ctx context.Context, id BuildId) error { + result, err := c.BuildServiceDeleteBuild(ctx, id) + if err != nil { + return fmt.Errorf("performing BuildServiceDeleteBuild: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BuildServiceDeleteBuild: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuild.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuild.go new file mode 100644 index 00000000000..3c1248a1c36 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuild.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceGetBuildOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Build +} + +// BuildServiceGetBuild ... +func (c AppPlatformClient) BuildServiceGetBuild(ctx context.Context, id BuildId) (result BuildServiceGetBuildOperationResponse, 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 + } + + var model Build + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresult.go new file mode 100644 index 00000000000..d9cbe5b06af --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresult.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceGetBuildResultOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BuildResult +} + +// BuildServiceGetBuildResult ... +func (c AppPlatformClient) BuildServiceGetBuildResult(ctx context.Context, id ResultId) (result BuildServiceGetBuildResultOperationResponse, 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 + } + + var model BuildResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresultlog.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresultlog.go new file mode 100644 index 00000000000..f025aeac949 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildresultlog.go @@ -0,0 +1,54 @@ +package appplatform + +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 BuildServiceGetBuildResultLogOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BuildResultLog +} + +// BuildServiceGetBuildResultLog ... +func (c AppPlatformClient) BuildServiceGetBuildResultLog(ctx context.Context, id ResultId) (result BuildServiceGetBuildResultLogOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getLogFileUrl", 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 + } + + var model BuildResultLog + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildservice.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildservice.go new file mode 100644 index 00000000000..03017c3fdd8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetbuildservice.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceGetBuildServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BuildService +} + +// BuildServiceGetBuildService ... +func (c AppPlatformClient) BuildServiceGetBuildService(ctx context.Context, id BuildServiceId) (result BuildServiceGetBuildServiceOperationResponse, 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 + } + + var model BuildService + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetresourceuploadurl.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetresourceuploadurl.go new file mode 100644 index 00000000000..6f268bd29bc --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetresourceuploadurl.go @@ -0,0 +1,54 @@ +package appplatform + +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 BuildServiceGetResourceUploadURLOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResourceUploadDefinition +} + +// BuildServiceGetResourceUploadURL ... +func (c AppPlatformClient) BuildServiceGetResourceUploadURL(ctx context.Context, id BuildServiceId) (result BuildServiceGetResourceUploadURLOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getResourceUploadUrl", 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 + } + + var model ResourceUploadDefinition + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedbuildpack.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedbuildpack.go new file mode 100644 index 00000000000..e1f390735d4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedbuildpack.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceGetSupportedBuildpackOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SupportedBuildpackResource +} + +// BuildServiceGetSupportedBuildpack ... +func (c AppPlatformClient) BuildServiceGetSupportedBuildpack(ctx context.Context, id SupportedBuildPackId) (result BuildServiceGetSupportedBuildpackOperationResponse, 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 + } + + var model SupportedBuildpackResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedstack.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedstack.go new file mode 100644 index 00000000000..6c8f254c7d1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicegetsupportedstack.go @@ -0,0 +1,53 @@ +package appplatform + +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 BuildServiceGetSupportedStackOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SupportedStackResource +} + +// BuildServiceGetSupportedStack ... +func (c AppPlatformClient) BuildServiceGetSupportedStack(ctx context.Context, id SupportedStackId) (result BuildServiceGetSupportedStackOperationResponse, 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 + } + + var model SupportedStackResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildresults.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildresults.go new file mode 100644 index 00000000000..07aada4094d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildresults.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildServiceListBuildResultsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BuildResult +} + +type BuildServiceListBuildResultsCompleteResult struct { + LatestHttpResponse *http.Response + Items []BuildResult +} + +type BuildServiceListBuildResultsCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceListBuildResultsCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceListBuildResults ... +func (c AppPlatformClient) BuildServiceListBuildResults(ctx context.Context, id BuildId) (result BuildServiceListBuildResultsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceListBuildResultsCustomPager{}, + Path: fmt.Sprintf("%s/results", 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 *[]BuildResult `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceListBuildResultsComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceListBuildResultsComplete(ctx context.Context, id BuildId) (BuildServiceListBuildResultsCompleteResult, error) { + return c.BuildServiceListBuildResultsCompleteMatchingPredicate(ctx, id, BuildResultOperationPredicate{}) +} + +// BuildServiceListBuildResultsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceListBuildResultsCompleteMatchingPredicate(ctx context.Context, id BuildId, predicate BuildResultOperationPredicate) (result BuildServiceListBuildResultsCompleteResult, err error) { + items := make([]BuildResult, 0) + + resp, err := c.BuildServiceListBuildResults(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceListBuildResultsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuilds.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuilds.go new file mode 100644 index 00000000000..edbc9154661 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuilds.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildServiceListBuildsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Build +} + +type BuildServiceListBuildsCompleteResult struct { + LatestHttpResponse *http.Response + Items []Build +} + +type BuildServiceListBuildsCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceListBuildsCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceListBuilds ... +func (c AppPlatformClient) BuildServiceListBuilds(ctx context.Context, id BuildServiceId) (result BuildServiceListBuildsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceListBuildsCustomPager{}, + Path: fmt.Sprintf("%s/builds", 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 *[]Build `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceListBuildsComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceListBuildsComplete(ctx context.Context, id BuildServiceId) (BuildServiceListBuildsCompleteResult, error) { + return c.BuildServiceListBuildsCompleteMatchingPredicate(ctx, id, BuildOperationPredicate{}) +} + +// BuildServiceListBuildsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceListBuildsCompleteMatchingPredicate(ctx context.Context, id BuildServiceId, predicate BuildOperationPredicate) (result BuildServiceListBuildsCompleteResult, err error) { + items := make([]Build, 0) + + resp, err := c.BuildServiceListBuilds(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceListBuildsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildservices.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildservices.go new file mode 100644 index 00000000000..0bcf2638b88 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistbuildservices.go @@ -0,0 +1,106 @@ +package appplatform + +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 BuildServiceListBuildServicesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BuildService +} + +type BuildServiceListBuildServicesCompleteResult struct { + LatestHttpResponse *http.Response + Items []BuildService +} + +type BuildServiceListBuildServicesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceListBuildServicesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceListBuildServices ... +func (c AppPlatformClient) BuildServiceListBuildServices(ctx context.Context, id commonids.SpringCloudServiceId) (result BuildServiceListBuildServicesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceListBuildServicesCustomPager{}, + Path: fmt.Sprintf("%s/buildServices", 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 *[]BuildService `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceListBuildServicesComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceListBuildServicesComplete(ctx context.Context, id commonids.SpringCloudServiceId) (BuildServiceListBuildServicesCompleteResult, error) { + return c.BuildServiceListBuildServicesCompleteMatchingPredicate(ctx, id, BuildServiceOperationPredicate{}) +} + +// BuildServiceListBuildServicesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceListBuildServicesCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate BuildServiceOperationPredicate) (result BuildServiceListBuildServicesCompleteResult, err error) { + items := make([]BuildService, 0) + + resp, err := c.BuildServiceListBuildServices(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceListBuildServicesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedbuildpacks.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedbuildpacks.go new file mode 100644 index 00000000000..8dc624021c3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedbuildpacks.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildServiceListSupportedBuildpacksOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SupportedBuildpackResource +} + +type BuildServiceListSupportedBuildpacksCompleteResult struct { + LatestHttpResponse *http.Response + Items []SupportedBuildpackResource +} + +type BuildServiceListSupportedBuildpacksCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceListSupportedBuildpacksCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceListSupportedBuildpacks ... +func (c AppPlatformClient) BuildServiceListSupportedBuildpacks(ctx context.Context, id BuildServiceId) (result BuildServiceListSupportedBuildpacksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceListSupportedBuildpacksCustomPager{}, + Path: fmt.Sprintf("%s/supportedBuildPacks", 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 *[]SupportedBuildpackResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceListSupportedBuildpacksComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceListSupportedBuildpacksComplete(ctx context.Context, id BuildServiceId) (BuildServiceListSupportedBuildpacksCompleteResult, error) { + return c.BuildServiceListSupportedBuildpacksCompleteMatchingPredicate(ctx, id, SupportedBuildpackResourceOperationPredicate{}) +} + +// BuildServiceListSupportedBuildpacksCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceListSupportedBuildpacksCompleteMatchingPredicate(ctx context.Context, id BuildServiceId, predicate SupportedBuildpackResourceOperationPredicate) (result BuildServiceListSupportedBuildpacksCompleteResult, err error) { + items := make([]SupportedBuildpackResource, 0) + + resp, err := c.BuildServiceListSupportedBuildpacks(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceListSupportedBuildpacksCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedstacks.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedstacks.go new file mode 100644 index 00000000000..36afe2ccfe3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_buildservicelistsupportedstacks.go @@ -0,0 +1,105 @@ +package appplatform + +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 BuildServiceListSupportedStacksOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SupportedStackResource +} + +type BuildServiceListSupportedStacksCompleteResult struct { + LatestHttpResponse *http.Response + Items []SupportedStackResource +} + +type BuildServiceListSupportedStacksCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *BuildServiceListSupportedStacksCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// BuildServiceListSupportedStacks ... +func (c AppPlatformClient) BuildServiceListSupportedStacks(ctx context.Context, id BuildServiceId) (result BuildServiceListSupportedStacksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &BuildServiceListSupportedStacksCustomPager{}, + Path: fmt.Sprintf("%s/supportedStacks", 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 *[]SupportedStackResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// BuildServiceListSupportedStacksComplete retrieves all the results into a single object +func (c AppPlatformClient) BuildServiceListSupportedStacksComplete(ctx context.Context, id BuildServiceId) (BuildServiceListSupportedStacksCompleteResult, error) { + return c.BuildServiceListSupportedStacksCompleteMatchingPredicate(ctx, id, SupportedStackResourceOperationPredicate{}) +} + +// BuildServiceListSupportedStacksCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) BuildServiceListSupportedStacksCompleteMatchingPredicate(ctx context.Context, id BuildServiceId, predicate SupportedStackResourceOperationPredicate) (result BuildServiceListSupportedStacksCompleteResult, err error) { + items := make([]SupportedStackResource, 0) + + resp, err := c.BuildServiceListSupportedStacks(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = BuildServiceListSupportedStacksCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatescreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatescreateorupdate.go new file mode 100644 index 00000000000..da02273a610 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatescreateorupdate.go @@ -0,0 +1,76 @@ +package appplatform + +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 CertificatesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CertificateResource +} + +// CertificatesCreateOrUpdate ... +func (c AppPlatformClient) CertificatesCreateOrUpdate(ctx context.Context, id CertificateId, input CertificateResource) (result CertificatesCreateOrUpdateOperationResponse, 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 +} + +// CertificatesCreateOrUpdateThenPoll performs CertificatesCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) CertificatesCreateOrUpdateThenPoll(ctx context.Context, id CertificateId, input CertificateResource) error { + result, err := c.CertificatesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CertificatesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CertificatesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesdelete.go new file mode 100644 index 00000000000..e8e5065bf5d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 CertificatesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CertificatesDelete ... +func (c AppPlatformClient) CertificatesDelete(ctx context.Context, id CertificateId) (result CertificatesDeleteOperationResponse, 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 +} + +// CertificatesDeleteThenPoll performs CertificatesDelete then polls until it's completed +func (c AppPlatformClient) CertificatesDeleteThenPoll(ctx context.Context, id CertificateId) error { + result, err := c.CertificatesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing CertificatesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CertificatesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesget.go new file mode 100644 index 00000000000..402d3daf21f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificatesget.go @@ -0,0 +1,53 @@ +package appplatform + +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 CertificatesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateResource +} + +// CertificatesGet ... +func (c AppPlatformClient) CertificatesGet(ctx context.Context, id CertificateId) (result CertificatesGetOperationResponse, 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 + } + + var model CertificateResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificateslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificateslist.go new file mode 100644 index 00000000000..44382d3cc61 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_certificateslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 CertificatesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CertificateResource +} + +type CertificatesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []CertificateResource +} + +type CertificatesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *CertificatesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// CertificatesList ... +func (c AppPlatformClient) CertificatesList(ctx context.Context, id commonids.SpringCloudServiceId) (result CertificatesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &CertificatesListCustomPager{}, + Path: fmt.Sprintf("%s/certificates", 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 *[]CertificateResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// CertificatesListComplete retrieves all the results into a single object +func (c AppPlatformClient) CertificatesListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (CertificatesListCompleteResult, error) { + return c.CertificatesListCompleteMatchingPredicate(ctx, id, CertificateResourceOperationPredicate{}) +} + +// CertificatesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) CertificatesListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate CertificateResourceOperationPredicate) (result CertificatesListCompleteResult, err error) { + items := make([]CertificateResource, 0) + + resp, err := c.CertificatesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = CertificatesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversdelete.go new file mode 100644 index 00000000000..7d3b3d3567e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversdelete.go @@ -0,0 +1,71 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServersDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConfigServersDelete ... +func (c AppPlatformClient) ConfigServersDelete(ctx context.Context, id commonids.SpringCloudServiceId) (result ConfigServersDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/configServers/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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ConfigServersDeleteThenPoll performs ConfigServersDelete then polls until it's completed +func (c AppPlatformClient) ConfigServersDeleteThenPoll(ctx context.Context, id commonids.SpringCloudServiceId) error { + result, err := c.ConfigServersDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ConfigServersDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigServersDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversget.go new file mode 100644 index 00000000000..9d926525ebb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversget.go @@ -0,0 +1,55 @@ +package appplatform + +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 ConfigServersGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigServerResource +} + +// ConfigServersGet ... +func (c AppPlatformClient) ConfigServersGet(ctx context.Context, id commonids.SpringCloudServiceId) (result ConfigServersGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/configServers/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 + } + + var model ConfigServerResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserverslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserverslist.go new file mode 100644 index 00000000000..12f06486923 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserverslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ConfigServersListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ConfigServerResource +} + +type ConfigServersListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ConfigServerResource +} + +type ConfigServersListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ConfigServersListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ConfigServersList ... +func (c AppPlatformClient) ConfigServersList(ctx context.Context, id commonids.SpringCloudServiceId) (result ConfigServersListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ConfigServersListCustomPager{}, + Path: fmt.Sprintf("%s/configServers", 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 *[]ConfigServerResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ConfigServersListComplete retrieves all the results into a single object +func (c AppPlatformClient) ConfigServersListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ConfigServersListCompleteResult, error) { + return c.ConfigServersListCompleteMatchingPredicate(ctx, id, ConfigServerResourceOperationPredicate{}) +} + +// ConfigServersListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ConfigServersListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ConfigServerResourceOperationPredicate) (result ConfigServersListCompleteResult, err error) { + items := make([]ConfigServerResource, 0) + + resp, err := c.ConfigServersList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ConfigServersListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdatepatch.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdatepatch.go new file mode 100644 index 00000000000..4ced7f7afd2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdatepatch.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServersUpdatePatchOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ConfigServerResource +} + +// ConfigServersUpdatePatch ... +func (c AppPlatformClient) ConfigServersUpdatePatch(ctx context.Context, id commonids.SpringCloudServiceId, input ConfigServerResource) (result ConfigServersUpdatePatchOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/configServers/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 +} + +// ConfigServersUpdatePatchThenPoll performs ConfigServersUpdatePatch then polls until it's completed +func (c AppPlatformClient) ConfigServersUpdatePatchThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ConfigServerResource) error { + result, err := c.ConfigServersUpdatePatch(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigServersUpdatePatch: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigServersUpdatePatch: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdateput.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdateput.go new file mode 100644 index 00000000000..d1ed7b68975 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversupdateput.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServersUpdatePutOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ConfigServerResource +} + +// ConfigServersUpdatePut ... +func (c AppPlatformClient) ConfigServersUpdatePut(ctx context.Context, id commonids.SpringCloudServiceId, input ConfigServerResource) (result ConfigServersUpdatePutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/configServers/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 +} + +// ConfigServersUpdatePutThenPoll performs ConfigServersUpdatePut then polls until it's completed +func (c AppPlatformClient) ConfigServersUpdatePutThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ConfigServerResource) error { + result, err := c.ConfigServersUpdatePut(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigServersUpdatePut: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigServersUpdatePut: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversvalidate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversvalidate.go new file mode 100644 index 00000000000..ec6efe38314 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configserversvalidate.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServersValidateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ConfigServerSettingsValidateResult +} + +// ConfigServersValidate ... +func (c AppPlatformClient) ConfigServersValidate(ctx context.Context, id commonids.SpringCloudServiceId, input ConfigServerSettings) (result ConfigServersValidateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/configServers/validate", 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 +} + +// ConfigServersValidateThenPoll performs ConfigServersValidate then polls until it's completed +func (c AppPlatformClient) ConfigServersValidateThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ConfigServerSettings) error { + result, err := c.ConfigServersValidate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigServersValidate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigServersValidate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicescreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicescreateorupdate.go new file mode 100644 index 00000000000..c2ee95e12b7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicescreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ConfigurationServicesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationServiceResource +} + +// ConfigurationServicesCreateOrUpdate ... +func (c AppPlatformClient) ConfigurationServicesCreateOrUpdate(ctx context.Context, id ConfigurationServiceId, input ConfigurationServiceResource) (result ConfigurationServicesCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ConfigurationServicesCreateOrUpdateThenPoll performs ConfigurationServicesCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ConfigurationServicesCreateOrUpdateThenPoll(ctx context.Context, id ConfigurationServiceId, input ConfigurationServiceResource) error { + result, err := c.ConfigurationServicesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigurationServicesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigurationServicesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesdelete.go new file mode 100644 index 00000000000..84e57b13968 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 ConfigurationServicesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConfigurationServicesDelete ... +func (c AppPlatformClient) ConfigurationServicesDelete(ctx context.Context, id ConfigurationServiceId) (result ConfigurationServicesDeleteOperationResponse, 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 +} + +// ConfigurationServicesDeleteThenPoll performs ConfigurationServicesDelete then polls until it's completed +func (c AppPlatformClient) ConfigurationServicesDeleteThenPoll(ctx context.Context, id ConfigurationServiceId) error { + result, err := c.ConfigurationServicesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ConfigurationServicesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigurationServicesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesget.go new file mode 100644 index 00000000000..6182cda68a0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ConfigurationServicesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationServiceResource +} + +// ConfigurationServicesGet ... +func (c AppPlatformClient) ConfigurationServicesGet(ctx context.Context, id ConfigurationServiceId) (result ConfigurationServicesGetOperationResponse, 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 + } + + var model ConfigurationServiceResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationserviceslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationserviceslist.go new file mode 100644 index 00000000000..f756bb8dcb7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationserviceslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ConfigurationServicesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ConfigurationServiceResource +} + +type ConfigurationServicesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ConfigurationServiceResource +} + +type ConfigurationServicesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ConfigurationServicesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ConfigurationServicesList ... +func (c AppPlatformClient) ConfigurationServicesList(ctx context.Context, id commonids.SpringCloudServiceId) (result ConfigurationServicesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ConfigurationServicesListCustomPager{}, + Path: fmt.Sprintf("%s/configurationServices", 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 *[]ConfigurationServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ConfigurationServicesListComplete retrieves all the results into a single object +func (c AppPlatformClient) ConfigurationServicesListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ConfigurationServicesListCompleteResult, error) { + return c.ConfigurationServicesListCompleteMatchingPredicate(ctx, id, ConfigurationServiceResourceOperationPredicate{}) +} + +// ConfigurationServicesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ConfigurationServicesListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ConfigurationServiceResourceOperationPredicate) (result ConfigurationServicesListCompleteResult, err error) { + items := make([]ConfigurationServiceResource, 0) + + resp, err := c.ConfigurationServicesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ConfigurationServicesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidate.go new file mode 100644 index 00000000000..0d072ea2258 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ConfigurationServicesValidateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationServiceSettingsValidateResult +} + +// ConfigurationServicesValidate ... +func (c AppPlatformClient) ConfigurationServicesValidate(ctx context.Context, id ConfigurationServiceId, input ConfigurationServiceSettings) (result ConfigurationServicesValidateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validate", 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 +} + +// ConfigurationServicesValidateThenPoll performs ConfigurationServicesValidate then polls until it's completed +func (c AppPlatformClient) ConfigurationServicesValidateThenPoll(ctx context.Context, id ConfigurationServiceId, input ConfigurationServiceSettings) error { + result, err := c.ConfigurationServicesValidate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigurationServicesValidate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigurationServicesValidate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidateresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidateresource.go new file mode 100644 index 00000000000..9528b5d3257 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_configurationservicesvalidateresource.go @@ -0,0 +1,75 @@ +package appplatform + +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 ConfigurationServicesValidateResourceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationServiceSettingsValidateResult +} + +// ConfigurationServicesValidateResource ... +func (c AppPlatformClient) ConfigurationServicesValidateResource(ctx context.Context, id ConfigurationServiceId, input ConfigurationServiceResource) (result ConfigurationServicesValidateResourceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateResource", 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 +} + +// ConfigurationServicesValidateResourceThenPoll performs ConfigurationServicesValidateResource then polls until it's completed +func (c AppPlatformClient) ConfigurationServicesValidateResourceThenPoll(ctx context.Context, id ConfigurationServiceId, input ConfigurationServiceResource) error { + result, err := c.ConfigurationServicesValidateResource(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigurationServicesValidateResource: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigurationServicesValidateResource: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriescreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriescreateorupdate.go new file mode 100644 index 00000000000..6018e109697 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriescreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ContainerRegistriesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ContainerRegistryResource +} + +// ContainerRegistriesCreateOrUpdate ... +func (c AppPlatformClient) ContainerRegistriesCreateOrUpdate(ctx context.Context, id ContainerRegistryId, input ContainerRegistryResource) (result ContainerRegistriesCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ContainerRegistriesCreateOrUpdateThenPoll performs ContainerRegistriesCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ContainerRegistriesCreateOrUpdateThenPoll(ctx context.Context, id ContainerRegistryId, input ContainerRegistryResource) error { + result, err := c.ContainerRegistriesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ContainerRegistriesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerRegistriesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesdelete.go new file mode 100644 index 00000000000..9ca224381a2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 ContainerRegistriesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ContainerRegistriesDelete ... +func (c AppPlatformClient) ContainerRegistriesDelete(ctx context.Context, id ContainerRegistryId) (result ContainerRegistriesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// ContainerRegistriesDeleteThenPoll performs ContainerRegistriesDelete then polls until it's completed +func (c AppPlatformClient) ContainerRegistriesDeleteThenPoll(ctx context.Context, id ContainerRegistryId) error { + result, err := c.ContainerRegistriesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerRegistriesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerRegistriesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesget.go new file mode 100644 index 00000000000..721f5cf55c9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ContainerRegistriesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerRegistryResource +} + +// ContainerRegistriesGet ... +func (c AppPlatformClient) ContainerRegistriesGet(ctx context.Context, id ContainerRegistryId) (result ContainerRegistriesGetOperationResponse, 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 + } + + var model ContainerRegistryResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistrieslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistrieslist.go new file mode 100644 index 00000000000..f95216e78b3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistrieslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ContainerRegistriesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContainerRegistryResource +} + +type ContainerRegistriesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ContainerRegistryResource +} + +type ContainerRegistriesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ContainerRegistriesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ContainerRegistriesList ... +func (c AppPlatformClient) ContainerRegistriesList(ctx context.Context, id commonids.SpringCloudServiceId) (result ContainerRegistriesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ContainerRegistriesListCustomPager{}, + Path: fmt.Sprintf("%s/containerRegistries", 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 *[]ContainerRegistryResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContainerRegistriesListComplete retrieves all the results into a single object +func (c AppPlatformClient) ContainerRegistriesListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ContainerRegistriesListCompleteResult, error) { + return c.ContainerRegistriesListCompleteMatchingPredicate(ctx, id, ContainerRegistryResourceOperationPredicate{}) +} + +// ContainerRegistriesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ContainerRegistriesListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ContainerRegistryResourceOperationPredicate) (result ContainerRegistriesListCompleteResult, err error) { + items := make([]ContainerRegistryResource, 0) + + resp, err := c.ContainerRegistriesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ContainerRegistriesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesvalidate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesvalidate.go new file mode 100644 index 00000000000..0d6e5904a74 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_containerregistriesvalidate.go @@ -0,0 +1,75 @@ +package appplatform + +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 ContainerRegistriesValidateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ContainerRegistryValidateResult +} + +// ContainerRegistriesValidate ... +func (c AppPlatformClient) ContainerRegistriesValidate(ctx context.Context, id ContainerRegistryId, input ContainerRegistryProperties) (result ContainerRegistriesValidateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validate", 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 +} + +// ContainerRegistriesValidateThenPoll performs ContainerRegistriesValidate then polls until it's completed +func (c AppPlatformClient) ContainerRegistriesValidateThenPoll(ctx context.Context, id ContainerRegistryId, input ContainerRegistryProperties) error { + result, err := c.ContainerRegistriesValidate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ContainerRegistriesValidate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerRegistriesValidate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainscreateorupdate.go new file mode 100644 index 00000000000..d9d4c7f5f2b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainscreateorupdate.go @@ -0,0 +1,76 @@ +package appplatform + +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 CustomDomainsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CustomDomainResource +} + +// CustomDomainsCreateOrUpdate ... +func (c AppPlatformClient) CustomDomainsCreateOrUpdate(ctx context.Context, id DomainId, input CustomDomainResource) (result CustomDomainsCreateOrUpdateOperationResponse, 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 +} + +// CustomDomainsCreateOrUpdateThenPoll performs CustomDomainsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) CustomDomainsCreateOrUpdateThenPoll(ctx context.Context, id DomainId, input CustomDomainResource) error { + result, err := c.CustomDomainsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CustomDomainsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CustomDomainsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsdelete.go new file mode 100644 index 00000000000..299f937e354 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 CustomDomainsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CustomDomainsDelete ... +func (c AppPlatformClient) CustomDomainsDelete(ctx context.Context, id DomainId) (result CustomDomainsDeleteOperationResponse, 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 +} + +// CustomDomainsDeleteThenPoll performs CustomDomainsDelete then polls until it's completed +func (c AppPlatformClient) CustomDomainsDeleteThenPoll(ctx context.Context, id DomainId) error { + result, err := c.CustomDomainsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing CustomDomainsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CustomDomainsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsget.go new file mode 100644 index 00000000000..5029cb05619 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 CustomDomainsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CustomDomainResource +} + +// CustomDomainsGet ... +func (c AppPlatformClient) CustomDomainsGet(ctx context.Context, id DomainId) (result CustomDomainsGetOperationResponse, 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 + } + + var model CustomDomainResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainslist.go new file mode 100644 index 00000000000..71ca1ab1862 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 CustomDomainsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CustomDomainResource +} + +type CustomDomainsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []CustomDomainResource +} + +type CustomDomainsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *CustomDomainsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// CustomDomainsList ... +func (c AppPlatformClient) CustomDomainsList(ctx context.Context, id AppId) (result CustomDomainsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &CustomDomainsListCustomPager{}, + Path: fmt.Sprintf("%s/domains", 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 *[]CustomDomainResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// CustomDomainsListComplete retrieves all the results into a single object +func (c AppPlatformClient) CustomDomainsListComplete(ctx context.Context, id AppId) (CustomDomainsListCompleteResult, error) { + return c.CustomDomainsListCompleteMatchingPredicate(ctx, id, CustomDomainResourceOperationPredicate{}) +} + +// CustomDomainsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) CustomDomainsListCompleteMatchingPredicate(ctx context.Context, id AppId, predicate CustomDomainResourceOperationPredicate) (result CustomDomainsListCompleteResult, err error) { + items := make([]CustomDomainResource, 0) + + resp, err := c.CustomDomainsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = CustomDomainsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsupdate.go new file mode 100644 index 00000000000..014a21f48b8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customdomainsupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 CustomDomainsUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CustomDomainResource +} + +// CustomDomainsUpdate ... +func (c AppPlatformClient) CustomDomainsUpdate(ctx context.Context, id DomainId, input CustomDomainResource) (result CustomDomainsUpdateOperationResponse, 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 +} + +// CustomDomainsUpdateThenPoll performs CustomDomainsUpdate then polls until it's completed +func (c AppPlatformClient) CustomDomainsUpdateThenPoll(ctx context.Context, id DomainId, input CustomDomainResource) error { + result, err := c.CustomDomainsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CustomDomainsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CustomDomainsUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorscreateorupdate.go new file mode 100644 index 00000000000..994d5cd21b6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 CustomizedAcceleratorsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CustomizedAcceleratorResource +} + +// CustomizedAcceleratorsCreateOrUpdate ... +func (c AppPlatformClient) CustomizedAcceleratorsCreateOrUpdate(ctx context.Context, id CustomizedAcceleratorId, input CustomizedAcceleratorResource) (result CustomizedAcceleratorsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CustomizedAcceleratorsCreateOrUpdateThenPoll performs CustomizedAcceleratorsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) CustomizedAcceleratorsCreateOrUpdateThenPoll(ctx context.Context, id CustomizedAcceleratorId, input CustomizedAcceleratorResource) error { + result, err := c.CustomizedAcceleratorsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CustomizedAcceleratorsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CustomizedAcceleratorsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsdelete.go new file mode 100644 index 00000000000..fc072a24428 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 CustomizedAcceleratorsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CustomizedAcceleratorsDelete ... +func (c AppPlatformClient) CustomizedAcceleratorsDelete(ctx context.Context, id CustomizedAcceleratorId) (result CustomizedAcceleratorsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// CustomizedAcceleratorsDeleteThenPoll performs CustomizedAcceleratorsDelete then polls until it's completed +func (c AppPlatformClient) CustomizedAcceleratorsDeleteThenPoll(ctx context.Context, id CustomizedAcceleratorId) error { + result, err := c.CustomizedAcceleratorsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing CustomizedAcceleratorsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CustomizedAcceleratorsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsget.go new file mode 100644 index 00000000000..7197ce868af --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 CustomizedAcceleratorsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CustomizedAcceleratorResource +} + +// CustomizedAcceleratorsGet ... +func (c AppPlatformClient) CustomizedAcceleratorsGet(ctx context.Context, id CustomizedAcceleratorId) (result CustomizedAcceleratorsGetOperationResponse, 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 + } + + var model CustomizedAcceleratorResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorslist.go new file mode 100644 index 00000000000..9f94567ade3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 CustomizedAcceleratorsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CustomizedAcceleratorResource +} + +type CustomizedAcceleratorsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []CustomizedAcceleratorResource +} + +type CustomizedAcceleratorsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *CustomizedAcceleratorsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// CustomizedAcceleratorsList ... +func (c AppPlatformClient) CustomizedAcceleratorsList(ctx context.Context, id ApplicationAcceleratorId) (result CustomizedAcceleratorsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &CustomizedAcceleratorsListCustomPager{}, + Path: fmt.Sprintf("%s/customizedAccelerators", 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 *[]CustomizedAcceleratorResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// CustomizedAcceleratorsListComplete retrieves all the results into a single object +func (c AppPlatformClient) CustomizedAcceleratorsListComplete(ctx context.Context, id ApplicationAcceleratorId) (CustomizedAcceleratorsListCompleteResult, error) { + return c.CustomizedAcceleratorsListCompleteMatchingPredicate(ctx, id, CustomizedAcceleratorResourceOperationPredicate{}) +} + +// CustomizedAcceleratorsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) CustomizedAcceleratorsListCompleteMatchingPredicate(ctx context.Context, id ApplicationAcceleratorId, predicate CustomizedAcceleratorResourceOperationPredicate) (result CustomizedAcceleratorsListCompleteResult, err error) { + items := make([]CustomizedAcceleratorResource, 0) + + resp, err := c.CustomizedAcceleratorsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = CustomizedAcceleratorsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsvalidate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsvalidate.go new file mode 100644 index 00000000000..1448f26da13 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_customizedacceleratorsvalidate.go @@ -0,0 +1,75 @@ +package appplatform + +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 CustomizedAcceleratorsValidateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CustomizedAcceleratorValidateResult +} + +// CustomizedAcceleratorsValidate ... +func (c AppPlatformClient) CustomizedAcceleratorsValidate(ctx context.Context, id CustomizedAcceleratorId, input CustomizedAcceleratorProperties) (result CustomizedAcceleratorsValidateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validate", 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 +} + +// CustomizedAcceleratorsValidateThenPoll performs CustomizedAcceleratorsValidate then polls until it's completed +func (c AppPlatformClient) CustomizedAcceleratorsValidateThenPoll(ctx context.Context, id CustomizedAcceleratorId, input CustomizedAcceleratorProperties) error { + result, err := c.CustomizedAcceleratorsValidate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CustomizedAcceleratorsValidate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CustomizedAcceleratorsValidate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentscreateorupdate.go new file mode 100644 index 00000000000..34700fed82e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentscreateorupdate.go @@ -0,0 +1,76 @@ +package appplatform + +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 DeploymentsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DeploymentResource +} + +// DeploymentsCreateOrUpdate ... +func (c AppPlatformClient) DeploymentsCreateOrUpdate(ctx context.Context, id DeploymentId, input DeploymentResource) (result DeploymentsCreateOrUpdateOperationResponse, 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 +} + +// DeploymentsCreateOrUpdateThenPoll performs DeploymentsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) DeploymentsCreateOrUpdateThenPoll(ctx context.Context, id DeploymentId, input DeploymentResource) error { + result, err := c.DeploymentsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeploymentsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdelete.go new file mode 100644 index 00000000000..e77d73e3b30 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 DeploymentsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsDelete ... +func (c AppPlatformClient) DeploymentsDelete(ctx context.Context, id DeploymentId) (result DeploymentsDeleteOperationResponse, 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 +} + +// DeploymentsDeleteThenPoll performs DeploymentsDelete then polls until it's completed +func (c AppPlatformClient) DeploymentsDeleteThenPoll(ctx context.Context, id DeploymentId) error { + result, err := c.DeploymentsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DeploymentsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdisableremotedebugging.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdisableremotedebugging.go new file mode 100644 index 00000000000..d57f6f517e0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsdisableremotedebugging.go @@ -0,0 +1,71 @@ +package appplatform + +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 DeploymentsDisableRemoteDebuggingOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RemoteDebugging +} + +// DeploymentsDisableRemoteDebugging ... +func (c AppPlatformClient) DeploymentsDisableRemoteDebugging(ctx context.Context, id DeploymentId) (result DeploymentsDisableRemoteDebuggingOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/disableRemoteDebugging", 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 +} + +// DeploymentsDisableRemoteDebuggingThenPoll performs DeploymentsDisableRemoteDebugging then polls until it's completed +func (c AppPlatformClient) DeploymentsDisableRemoteDebuggingThenPoll(ctx context.Context, id DeploymentId) error { + result, err := c.DeploymentsDisableRemoteDebugging(ctx, id) + if err != nil { + return fmt.Errorf("performing DeploymentsDisableRemoteDebugging: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsDisableRemoteDebugging: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsenableremotedebugging.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsenableremotedebugging.go new file mode 100644 index 00000000000..18e7c7800a7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsenableremotedebugging.go @@ -0,0 +1,75 @@ +package appplatform + +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 DeploymentsEnableRemoteDebuggingOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RemoteDebugging +} + +// DeploymentsEnableRemoteDebugging ... +func (c AppPlatformClient) DeploymentsEnableRemoteDebugging(ctx context.Context, id DeploymentId, input RemoteDebuggingPayload) (result DeploymentsEnableRemoteDebuggingOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/enableRemoteDebugging", 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 +} + +// DeploymentsEnableRemoteDebuggingThenPoll performs DeploymentsEnableRemoteDebugging then polls until it's completed +func (c AppPlatformClient) DeploymentsEnableRemoteDebuggingThenPoll(ctx context.Context, id DeploymentId, input RemoteDebuggingPayload) error { + result, err := c.DeploymentsEnableRemoteDebugging(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeploymentsEnableRemoteDebugging: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsEnableRemoteDebugging: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgenerateheapdump.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgenerateheapdump.go new file mode 100644 index 00000000000..44da556d602 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgenerateheapdump.go @@ -0,0 +1,74 @@ +package appplatform + +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 DeploymentsGenerateHeapDumpOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsGenerateHeapDump ... +func (c AppPlatformClient) DeploymentsGenerateHeapDump(ctx context.Context, id DeploymentId, input DiagnosticParameters) (result DeploymentsGenerateHeapDumpOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateHeapDump", 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 +} + +// DeploymentsGenerateHeapDumpThenPoll performs DeploymentsGenerateHeapDump then polls until it's completed +func (c AppPlatformClient) DeploymentsGenerateHeapDumpThenPoll(ctx context.Context, id DeploymentId, input DiagnosticParameters) error { + result, err := c.DeploymentsGenerateHeapDump(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeploymentsGenerateHeapDump: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsGenerateHeapDump: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgeneratethreaddump.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgeneratethreaddump.go new file mode 100644 index 00000000000..c54c5f2391f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgeneratethreaddump.go @@ -0,0 +1,74 @@ +package appplatform + +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 DeploymentsGenerateThreadDumpOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsGenerateThreadDump ... +func (c AppPlatformClient) DeploymentsGenerateThreadDump(ctx context.Context, id DeploymentId, input DiagnosticParameters) (result DeploymentsGenerateThreadDumpOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateThreadDump", 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 +} + +// DeploymentsGenerateThreadDumpThenPoll performs DeploymentsGenerateThreadDump then polls until it's completed +func (c AppPlatformClient) DeploymentsGenerateThreadDumpThenPoll(ctx context.Context, id DeploymentId, input DiagnosticParameters) error { + result, err := c.DeploymentsGenerateThreadDump(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeploymentsGenerateThreadDump: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsGenerateThreadDump: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsget.go new file mode 100644 index 00000000000..cfbf6da94b6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 DeploymentsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DeploymentResource +} + +// DeploymentsGet ... +func (c AppPlatformClient) DeploymentsGet(ctx context.Context, id DeploymentId) (result DeploymentsGetOperationResponse, 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 + } + + var model DeploymentResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetlogfileurl.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetlogfileurl.go new file mode 100644 index 00000000000..26f6ba9df87 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetlogfileurl.go @@ -0,0 +1,55 @@ +package appplatform + +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 DeploymentsGetLogFileURLOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LogFileURLResponse +} + +// DeploymentsGetLogFileURL ... +func (c AppPlatformClient) DeploymentsGetLogFileURL(ctx context.Context, id DeploymentId) (result DeploymentsGetLogFileURLOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getLogFileUrl", 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 + } + + var model LogFileURLResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetremotedebuggingconfig.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetremotedebuggingconfig.go new file mode 100644 index 00000000000..6a8077b27f1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsgetremotedebuggingconfig.go @@ -0,0 +1,54 @@ +package appplatform + +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 DeploymentsGetRemoteDebuggingConfigOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RemoteDebugging +} + +// DeploymentsGetRemoteDebuggingConfig ... +func (c AppPlatformClient) DeploymentsGetRemoteDebuggingConfig(ctx context.Context, id DeploymentId) (result DeploymentsGetRemoteDebuggingConfigOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getRemoteDebuggingConfig", 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 + } + + var model RemoteDebugging + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslist.go new file mode 100644 index 00000000000..c0f57dc7744 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslist.go @@ -0,0 +1,138 @@ +package appplatform + +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 DeploymentsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DeploymentResource +} + +type DeploymentsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []DeploymentResource +} + +type DeploymentsListOperationOptions struct { + Expand *string + Version *[]string +} + +func DefaultDeploymentsListOperationOptions() DeploymentsListOperationOptions { + return DeploymentsListOperationOptions{} +} + +func (o DeploymentsListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeploymentsListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeploymentsListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Version != nil { + out.Append("version", fmt.Sprintf("%v", *o.Version)) + } + return &out +} + +type DeploymentsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *DeploymentsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// DeploymentsList ... +func (c AppPlatformClient) DeploymentsList(ctx context.Context, id AppId, options DeploymentsListOperationOptions) (result DeploymentsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &DeploymentsListCustomPager{}, + Path: fmt.Sprintf("%s/deployments", 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 *[]DeploymentResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DeploymentsListComplete retrieves all the results into a single object +func (c AppPlatformClient) DeploymentsListComplete(ctx context.Context, id AppId, options DeploymentsListOperationOptions) (DeploymentsListCompleteResult, error) { + return c.DeploymentsListCompleteMatchingPredicate(ctx, id, options, DeploymentResourceOperationPredicate{}) +} + +// DeploymentsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) DeploymentsListCompleteMatchingPredicate(ctx context.Context, id AppId, options DeploymentsListOperationOptions, predicate DeploymentResourceOperationPredicate) (result DeploymentsListCompleteResult, err error) { + items := make([]DeploymentResource, 0) + + resp, err := c.DeploymentsList(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = DeploymentsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslistforcluster.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslistforcluster.go new file mode 100644 index 00000000000..9e8454491d5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentslistforcluster.go @@ -0,0 +1,139 @@ +package appplatform + +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 DeploymentsListForClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DeploymentResource +} + +type DeploymentsListForClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []DeploymentResource +} + +type DeploymentsListForClusterOperationOptions struct { + Expand *string + Version *[]string +} + +func DefaultDeploymentsListForClusterOperationOptions() DeploymentsListForClusterOperationOptions { + return DeploymentsListForClusterOperationOptions{} +} + +func (o DeploymentsListForClusterOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeploymentsListForClusterOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeploymentsListForClusterOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Version != nil { + out.Append("version", fmt.Sprintf("%v", *o.Version)) + } + return &out +} + +type DeploymentsListForClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *DeploymentsListForClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// DeploymentsListForCluster ... +func (c AppPlatformClient) DeploymentsListForCluster(ctx context.Context, id commonids.SpringCloudServiceId, options DeploymentsListForClusterOperationOptions) (result DeploymentsListForClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &DeploymentsListForClusterCustomPager{}, + Path: fmt.Sprintf("%s/deployments", 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 *[]DeploymentResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DeploymentsListForClusterComplete retrieves all the results into a single object +func (c AppPlatformClient) DeploymentsListForClusterComplete(ctx context.Context, id commonids.SpringCloudServiceId, options DeploymentsListForClusterOperationOptions) (DeploymentsListForClusterCompleteResult, error) { + return c.DeploymentsListForClusterCompleteMatchingPredicate(ctx, id, options, DeploymentResourceOperationPredicate{}) +} + +// DeploymentsListForClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) DeploymentsListForClusterCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, options DeploymentsListForClusterOperationOptions, predicate DeploymentResourceOperationPredicate) (result DeploymentsListForClusterCompleteResult, err error) { + items := make([]DeploymentResource, 0) + + resp, err := c.DeploymentsListForCluster(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = DeploymentsListForClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsrestart.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsrestart.go new file mode 100644 index 00000000000..a613c56f497 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsrestart.go @@ -0,0 +1,70 @@ +package appplatform + +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 DeploymentsRestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsRestart ... +func (c AppPlatformClient) DeploymentsRestart(ctx context.Context, id DeploymentId) (result DeploymentsRestartOperationResponse, 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 +} + +// DeploymentsRestartThenPoll performs DeploymentsRestart then polls until it's completed +func (c AppPlatformClient) DeploymentsRestartThenPoll(ctx context.Context, id DeploymentId) error { + result, err := c.DeploymentsRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing DeploymentsRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsRestart: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstart.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstart.go new file mode 100644 index 00000000000..79ae2deacb6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstart.go @@ -0,0 +1,70 @@ +package appplatform + +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 DeploymentsStartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsStart ... +func (c AppPlatformClient) DeploymentsStart(ctx context.Context, id DeploymentId) (result DeploymentsStartOperationResponse, 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 +} + +// DeploymentsStartThenPoll performs DeploymentsStart then polls until it's completed +func (c AppPlatformClient) DeploymentsStartThenPoll(ctx context.Context, id DeploymentId) error { + result, err := c.DeploymentsStart(ctx, id) + if err != nil { + return fmt.Errorf("performing DeploymentsStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsStart: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstartjfr.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstartjfr.go new file mode 100644 index 00000000000..58158f371b9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstartjfr.go @@ -0,0 +1,74 @@ +package appplatform + +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 DeploymentsStartJFROperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsStartJFR ... +func (c AppPlatformClient) DeploymentsStartJFR(ctx context.Context, id DeploymentId, input DiagnosticParameters) (result DeploymentsStartJFROperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/startJFR", 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 +} + +// DeploymentsStartJFRThenPoll performs DeploymentsStartJFR then polls until it's completed +func (c AppPlatformClient) DeploymentsStartJFRThenPoll(ctx context.Context, id DeploymentId, input DiagnosticParameters) error { + result, err := c.DeploymentsStartJFR(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeploymentsStartJFR: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsStartJFR: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstop.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstop.go new file mode 100644 index 00000000000..da31db3f34d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsstop.go @@ -0,0 +1,70 @@ +package appplatform + +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 DeploymentsStopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeploymentsStop ... +func (c AppPlatformClient) DeploymentsStop(ctx context.Context, id DeploymentId) (result DeploymentsStopOperationResponse, 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 +} + +// DeploymentsStopThenPoll performs DeploymentsStop then polls until it's completed +func (c AppPlatformClient) DeploymentsStopThenPoll(ctx context.Context, id DeploymentId) error { + result, err := c.DeploymentsStop(ctx, id) + if err != nil { + return fmt.Errorf("performing DeploymentsStop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsStop: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsupdate.go new file mode 100644 index 00000000000..61be4bda9ea --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_deploymentsupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 DeploymentsUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DeploymentResource +} + +// DeploymentsUpdate ... +func (c AppPlatformClient) DeploymentsUpdate(ctx context.Context, id DeploymentId, input DeploymentResource) (result DeploymentsUpdateOperationResponse, 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 +} + +// DeploymentsUpdateThenPoll performs DeploymentsUpdate then polls until it's completed +func (c AppPlatformClient) DeploymentsUpdateThenPoll(ctx context.Context, id DeploymentId, input DeploymentResource) error { + result, err := c.DeploymentsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeploymentsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeploymentsUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalscreateorupdate.go new file mode 100644 index 00000000000..a3ee5db8639 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 DevToolPortalsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DevToolPortalResource +} + +// DevToolPortalsCreateOrUpdate ... +func (c AppPlatformClient) DevToolPortalsCreateOrUpdate(ctx context.Context, id DevToolPortalId, input DevToolPortalResource) (result DevToolPortalsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DevToolPortalsCreateOrUpdateThenPoll performs DevToolPortalsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) DevToolPortalsCreateOrUpdateThenPoll(ctx context.Context, id DevToolPortalId, input DevToolPortalResource) error { + result, err := c.DevToolPortalsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DevToolPortalsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DevToolPortalsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsdelete.go new file mode 100644 index 00000000000..1bdf7f32faa --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 DevToolPortalsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DevToolPortalsDelete ... +func (c AppPlatformClient) DevToolPortalsDelete(ctx context.Context, id DevToolPortalId) (result DevToolPortalsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// DevToolPortalsDeleteThenPoll performs DevToolPortalsDelete then polls until it's completed +func (c AppPlatformClient) DevToolPortalsDeleteThenPoll(ctx context.Context, id DevToolPortalId) error { + result, err := c.DevToolPortalsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DevToolPortalsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DevToolPortalsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsget.go new file mode 100644 index 00000000000..6684c6d0332 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 DevToolPortalsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DevToolPortalResource +} + +// DevToolPortalsGet ... +func (c AppPlatformClient) DevToolPortalsGet(ctx context.Context, id DevToolPortalId) (result DevToolPortalsGetOperationResponse, 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 + } + + var model DevToolPortalResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalslist.go new file mode 100644 index 00000000000..a8155187039 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_devtoolportalslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 DevToolPortalsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DevToolPortalResource +} + +type DevToolPortalsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []DevToolPortalResource +} + +type DevToolPortalsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *DevToolPortalsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// DevToolPortalsList ... +func (c AppPlatformClient) DevToolPortalsList(ctx context.Context, id commonids.SpringCloudServiceId) (result DevToolPortalsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &DevToolPortalsListCustomPager{}, + Path: fmt.Sprintf("%s/devToolPortals", 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 *[]DevToolPortalResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DevToolPortalsListComplete retrieves all the results into a single object +func (c AppPlatformClient) DevToolPortalsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (DevToolPortalsListCompleteResult, error) { + return c.DevToolPortalsListCompleteMatchingPredicate(ctx, id, DevToolPortalResourceOperationPredicate{}) +} + +// DevToolPortalsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) DevToolPortalsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate DevToolPortalResourceOperationPredicate) (result DevToolPortalsListCompleteResult, err error) { + items := make([]DevToolPortalResource, 0) + + resp, err := c.DevToolPortalsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = DevToolPortalsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversget.go new file mode 100644 index 00000000000..18a319e61bb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversget.go @@ -0,0 +1,55 @@ +package appplatform + +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 EurekaServersGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EurekaServerResource +} + +// EurekaServersGet ... +func (c AppPlatformClient) EurekaServersGet(ctx context.Context, id commonids.SpringCloudServiceId) (result EurekaServersGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/eurekaServers/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 + } + + var model EurekaServerResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserverslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserverslist.go new file mode 100644 index 00000000000..6bdac5c1414 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserverslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 EurekaServersListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]EurekaServerResource +} + +type EurekaServersListCompleteResult struct { + LatestHttpResponse *http.Response + Items []EurekaServerResource +} + +type EurekaServersListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *EurekaServersListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// EurekaServersList ... +func (c AppPlatformClient) EurekaServersList(ctx context.Context, id commonids.SpringCloudServiceId) (result EurekaServersListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &EurekaServersListCustomPager{}, + Path: fmt.Sprintf("%s/eurekaServers", 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 *[]EurekaServerResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// EurekaServersListComplete retrieves all the results into a single object +func (c AppPlatformClient) EurekaServersListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (EurekaServersListCompleteResult, error) { + return c.EurekaServersListCompleteMatchingPredicate(ctx, id, EurekaServerResourceOperationPredicate{}) +} + +// EurekaServersListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) EurekaServersListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate EurekaServerResourceOperationPredicate) (result EurekaServersListCompleteResult, err error) { + items := make([]EurekaServerResource, 0) + + resp, err := c.EurekaServersList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = EurekaServersListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdatepatch.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdatepatch.go new file mode 100644 index 00000000000..c25b951244d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdatepatch.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EurekaServersUpdatePatchOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *EurekaServerResource +} + +// EurekaServersUpdatePatch ... +func (c AppPlatformClient) EurekaServersUpdatePatch(ctx context.Context, id commonids.SpringCloudServiceId, input EurekaServerResource) (result EurekaServersUpdatePatchOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/eurekaServers/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 +} + +// EurekaServersUpdatePatchThenPoll performs EurekaServersUpdatePatch then polls until it's completed +func (c AppPlatformClient) EurekaServersUpdatePatchThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input EurekaServerResource) error { + result, err := c.EurekaServersUpdatePatch(ctx, id, input) + if err != nil { + return fmt.Errorf("performing EurekaServersUpdatePatch: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after EurekaServersUpdatePatch: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdateput.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdateput.go new file mode 100644 index 00000000000..997d919b68f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_eurekaserversupdateput.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EurekaServersUpdatePutOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *EurekaServerResource +} + +// EurekaServersUpdatePut ... +func (c AppPlatformClient) EurekaServersUpdatePut(ctx context.Context, id commonids.SpringCloudServiceId, input EurekaServerResource) (result EurekaServersUpdatePutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/eurekaServers/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 +} + +// EurekaServersUpdatePutThenPoll performs EurekaServersUpdatePut then polls until it's completed +func (c AppPlatformClient) EurekaServersUpdatePutThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input EurekaServerResource) error { + result, err := c.EurekaServersUpdatePut(ctx, id, input) + if err != nil { + return fmt.Errorf("performing EurekaServersUpdatePut: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after EurekaServersUpdatePut: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainscreateorupdate.go new file mode 100644 index 00000000000..308ced4d30a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 GatewayCustomDomainsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCustomDomainResource +} + +// GatewayCustomDomainsCreateOrUpdate ... +func (c AppPlatformClient) GatewayCustomDomainsCreateOrUpdate(ctx context.Context, id GatewayDomainId, input GatewayCustomDomainResource) (result GatewayCustomDomainsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// GatewayCustomDomainsCreateOrUpdateThenPoll performs GatewayCustomDomainsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) GatewayCustomDomainsCreateOrUpdateThenPoll(ctx context.Context, id GatewayDomainId, input GatewayCustomDomainResource) error { + result, err := c.GatewayCustomDomainsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing GatewayCustomDomainsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewayCustomDomainsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsdelete.go new file mode 100644 index 00000000000..b3043f74ad9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 GatewayCustomDomainsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// GatewayCustomDomainsDelete ... +func (c AppPlatformClient) GatewayCustomDomainsDelete(ctx context.Context, id GatewayDomainId) (result GatewayCustomDomainsDeleteOperationResponse, 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 +} + +// GatewayCustomDomainsDeleteThenPoll performs GatewayCustomDomainsDelete then polls until it's completed +func (c AppPlatformClient) GatewayCustomDomainsDeleteThenPoll(ctx context.Context, id GatewayDomainId) error { + result, err := c.GatewayCustomDomainsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing GatewayCustomDomainsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewayCustomDomainsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsget.go new file mode 100644 index 00000000000..64454f48288 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 GatewayCustomDomainsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCustomDomainResource +} + +// GatewayCustomDomainsGet ... +func (c AppPlatformClient) GatewayCustomDomainsGet(ctx context.Context, id GatewayDomainId) (result GatewayCustomDomainsGetOperationResponse, 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 + } + + var model GatewayCustomDomainResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainslist.go new file mode 100644 index 00000000000..9e16b2bc080 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaycustomdomainslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 GatewayCustomDomainsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayCustomDomainResource +} + +type GatewayCustomDomainsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []GatewayCustomDomainResource +} + +type GatewayCustomDomainsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *GatewayCustomDomainsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// GatewayCustomDomainsList ... +func (c AppPlatformClient) GatewayCustomDomainsList(ctx context.Context, id GatewayId) (result GatewayCustomDomainsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &GatewayCustomDomainsListCustomPager{}, + Path: fmt.Sprintf("%s/domains", 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 *[]GatewayCustomDomainResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GatewayCustomDomainsListComplete retrieves all the results into a single object +func (c AppPlatformClient) GatewayCustomDomainsListComplete(ctx context.Context, id GatewayId) (GatewayCustomDomainsListCompleteResult, error) { + return c.GatewayCustomDomainsListCompleteMatchingPredicate(ctx, id, GatewayCustomDomainResourceOperationPredicate{}) +} + +// GatewayCustomDomainsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) GatewayCustomDomainsListCompleteMatchingPredicate(ctx context.Context, id GatewayId, predicate GatewayCustomDomainResourceOperationPredicate) (result GatewayCustomDomainsListCompleteResult, err error) { + items := make([]GatewayCustomDomainResource, 0) + + resp, err := c.GatewayCustomDomainsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = GatewayCustomDomainsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigscreateorupdate.go new file mode 100644 index 00000000000..6824f689fbd --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 GatewayRouteConfigsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *GatewayRouteConfigResource +} + +// GatewayRouteConfigsCreateOrUpdate ... +func (c AppPlatformClient) GatewayRouteConfigsCreateOrUpdate(ctx context.Context, id RouteConfigId, input GatewayRouteConfigResource) (result GatewayRouteConfigsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// GatewayRouteConfigsCreateOrUpdateThenPoll performs GatewayRouteConfigsCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) GatewayRouteConfigsCreateOrUpdateThenPoll(ctx context.Context, id RouteConfigId, input GatewayRouteConfigResource) error { + result, err := c.GatewayRouteConfigsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing GatewayRouteConfigsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewayRouteConfigsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsdelete.go new file mode 100644 index 00000000000..b0d63e076fb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 GatewayRouteConfigsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// GatewayRouteConfigsDelete ... +func (c AppPlatformClient) GatewayRouteConfigsDelete(ctx context.Context, id RouteConfigId) (result GatewayRouteConfigsDeleteOperationResponse, 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 +} + +// GatewayRouteConfigsDeleteThenPoll performs GatewayRouteConfigsDelete then polls until it's completed +func (c AppPlatformClient) GatewayRouteConfigsDeleteThenPoll(ctx context.Context, id RouteConfigId) error { + result, err := c.GatewayRouteConfigsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing GatewayRouteConfigsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewayRouteConfigsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsget.go new file mode 100644 index 00000000000..80376391849 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 GatewayRouteConfigsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayRouteConfigResource +} + +// GatewayRouteConfigsGet ... +func (c AppPlatformClient) GatewayRouteConfigsGet(ctx context.Context, id RouteConfigId) (result GatewayRouteConfigsGetOperationResponse, 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 + } + + var model GatewayRouteConfigResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigslist.go new file mode 100644 index 00000000000..f17ce8caf9b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayrouteconfigslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 GatewayRouteConfigsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayRouteConfigResource +} + +type GatewayRouteConfigsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []GatewayRouteConfigResource +} + +type GatewayRouteConfigsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *GatewayRouteConfigsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// GatewayRouteConfigsList ... +func (c AppPlatformClient) GatewayRouteConfigsList(ctx context.Context, id GatewayId) (result GatewayRouteConfigsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &GatewayRouteConfigsListCustomPager{}, + Path: fmt.Sprintf("%s/routeConfigs", 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 *[]GatewayRouteConfigResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GatewayRouteConfigsListComplete retrieves all the results into a single object +func (c AppPlatformClient) GatewayRouteConfigsListComplete(ctx context.Context, id GatewayId) (GatewayRouteConfigsListCompleteResult, error) { + return c.GatewayRouteConfigsListCompleteMatchingPredicate(ctx, id, GatewayRouteConfigResourceOperationPredicate{}) +} + +// GatewayRouteConfigsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) GatewayRouteConfigsListCompleteMatchingPredicate(ctx context.Context, id GatewayId, predicate GatewayRouteConfigResourceOperationPredicate) (result GatewayRouteConfigsListCompleteResult, err error) { + items := make([]GatewayRouteConfigResource, 0) + + resp, err := c.GatewayRouteConfigsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = GatewayRouteConfigsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayscreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayscreateorupdate.go new file mode 100644 index 00000000000..ca9d4c77380 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayscreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 GatewaysCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *GatewayResource +} + +// GatewaysCreateOrUpdate ... +func (c AppPlatformClient) GatewaysCreateOrUpdate(ctx context.Context, id GatewayId, input GatewayResource) (result GatewaysCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// GatewaysCreateOrUpdateThenPoll performs GatewaysCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) GatewaysCreateOrUpdateThenPoll(ctx context.Context, id GatewayId, input GatewayResource) error { + result, err := c.GatewaysCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing GatewaysCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewaysCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysdelete.go new file mode 100644 index 00000000000..2b64350914b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 GatewaysDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// GatewaysDelete ... +func (c AppPlatformClient) GatewaysDelete(ctx context.Context, id GatewayId) (result GatewaysDeleteOperationResponse, 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 +} + +// GatewaysDeleteThenPoll performs GatewaysDelete then polls until it's completed +func (c AppPlatformClient) GatewaysDeleteThenPoll(ctx context.Context, id GatewayId) error { + result, err := c.GatewaysDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing GatewaysDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewaysDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysget.go new file mode 100644 index 00000000000..51ceea59d54 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysget.go @@ -0,0 +1,53 @@ +package appplatform + +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 GatewaysGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayResource +} + +// GatewaysGet ... +func (c AppPlatformClient) GatewaysGet(ctx context.Context, id GatewayId) (result GatewaysGetOperationResponse, 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 + } + + var model GatewayResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslist.go new file mode 100644 index 00000000000..d7ee33cb902 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 GatewaysListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayResource +} + +type GatewaysListCompleteResult struct { + LatestHttpResponse *http.Response + Items []GatewayResource +} + +type GatewaysListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *GatewaysListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// GatewaysList ... +func (c AppPlatformClient) GatewaysList(ctx context.Context, id commonids.SpringCloudServiceId) (result GatewaysListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &GatewaysListCustomPager{}, + Path: fmt.Sprintf("%s/gateways", 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 *[]GatewayResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GatewaysListComplete retrieves all the results into a single object +func (c AppPlatformClient) GatewaysListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (GatewaysListCompleteResult, error) { + return c.GatewaysListCompleteMatchingPredicate(ctx, id, GatewayResourceOperationPredicate{}) +} + +// GatewaysListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) GatewaysListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate GatewayResourceOperationPredicate) (result GatewaysListCompleteResult, err error) { + items := make([]GatewayResource, 0) + + resp, err := c.GatewaysList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = GatewaysListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslistenvsecrets.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslistenvsecrets.go new file mode 100644 index 00000000000..78b159baeab --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewayslistenvsecrets.go @@ -0,0 +1,54 @@ +package appplatform + +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 GatewaysListEnvSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *map[string]string +} + +// GatewaysListEnvSecrets ... +func (c AppPlatformClient) GatewaysListEnvSecrets(ctx context.Context, id GatewayId) (result GatewaysListEnvSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listEnvSecrets", 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 + } + + var model map[string]string + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysrestart.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysrestart.go new file mode 100644 index 00000000000..17b75ab261b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysrestart.go @@ -0,0 +1,70 @@ +package appplatform + +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 GatewaysRestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// GatewaysRestart ... +func (c AppPlatformClient) GatewaysRestart(ctx context.Context, id GatewayId) (result GatewaysRestartOperationResponse, 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 +} + +// GatewaysRestartThenPoll performs GatewaysRestart then polls until it's completed +func (c AppPlatformClient) GatewaysRestartThenPoll(ctx context.Context, id GatewayId) error { + result, err := c.GatewaysRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing GatewaysRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewaysRestart: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysupdatecapacity.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysupdatecapacity.go new file mode 100644 index 00000000000..955e52c4b21 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysupdatecapacity.go @@ -0,0 +1,75 @@ +package appplatform + +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 GatewaysUpdateCapacityOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *GatewayResource +} + +// GatewaysUpdateCapacity ... +func (c AppPlatformClient) GatewaysUpdateCapacity(ctx context.Context, id GatewayId, input SkuObject) (result GatewaysUpdateCapacityOperationResponse, 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 +} + +// GatewaysUpdateCapacityThenPoll performs GatewaysUpdateCapacity then polls until it's completed +func (c AppPlatformClient) GatewaysUpdateCapacityThenPoll(ctx context.Context, id GatewayId, input SkuObject) error { + result, err := c.GatewaysUpdateCapacity(ctx, id, input) + if err != nil { + return fmt.Errorf("performing GatewaysUpdateCapacity: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GatewaysUpdateCapacity: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysvalidatedomain.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysvalidatedomain.go new file mode 100644 index 00000000000..dbac66d1ce6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_gatewaysvalidatedomain.go @@ -0,0 +1,58 @@ +package appplatform + +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 GatewaysValidateDomainOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CustomDomainValidateResult +} + +// GatewaysValidateDomain ... +func (c AppPlatformClient) GatewaysValidateDomain(ctx context.Context, id GatewayId, input CustomDomainValidatePayload) (result GatewaysValidateDomainOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateDomain", 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 + } + + var model CustomDomainValidateResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobcreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobcreateorupdate.go new file mode 100644 index 00000000000..9ab6fd18775 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobcreateorupdate.go @@ -0,0 +1,75 @@ +package appplatform + +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 JobCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *JobResource +} + +// JobCreateOrUpdate ... +func (c AppPlatformClient) JobCreateOrUpdate(ctx context.Context, id JobId, input JobResource) (result JobCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// JobCreateOrUpdateThenPoll performs JobCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) JobCreateOrUpdateThenPoll(ctx context.Context, id JobId, input JobResource) error { + result, err := c.JobCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing JobCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after JobCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobdelete.go new file mode 100644 index 00000000000..c71ff04f7bf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobdelete.go @@ -0,0 +1,70 @@ +package appplatform + +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 JobDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// JobDelete ... +func (c AppPlatformClient) JobDelete(ctx context.Context, id JobId) (result JobDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 +} + +// JobDeleteThenPoll performs JobDelete then polls until it's completed +func (c AppPlatformClient) JobDeleteThenPoll(ctx context.Context, id JobId) error { + result, err := c.JobDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing JobDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after JobDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutioncancel.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutioncancel.go new file mode 100644 index 00000000000..d04081c2ad1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutioncancel.go @@ -0,0 +1,69 @@ +package appplatform + +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 JobExecutionCancelOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// JobExecutionCancel ... +func (c AppPlatformClient) JobExecutionCancel(ctx context.Context, id ExecutionId) (result JobExecutionCancelOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/cancel", 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 +} + +// JobExecutionCancelThenPoll performs JobExecutionCancel then polls until it's completed +func (c AppPlatformClient) JobExecutionCancelThenPoll(ctx context.Context, id ExecutionId) error { + result, err := c.JobExecutionCancel(ctx, id) + if err != nil { + return fmt.Errorf("performing JobExecutionCancel: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after JobExecutionCancel: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionget.go new file mode 100644 index 00000000000..cfb3936fbaf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionget.go @@ -0,0 +1,53 @@ +package appplatform + +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 JobExecutionGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *JobExecution +} + +// JobExecutionGet ... +func (c AppPlatformClient) JobExecutionGet(ctx context.Context, id ExecutionId) (result JobExecutionGetOperationResponse, 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 + } + + var model JobExecution + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionlistenvsecrets.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionlistenvsecrets.go new file mode 100644 index 00000000000..586bf2c9d6a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionlistenvsecrets.go @@ -0,0 +1,54 @@ +package appplatform + +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 JobExecutionListEnvSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EnvSecretsCollection +} + +// JobExecutionListEnvSecrets ... +func (c AppPlatformClient) JobExecutionListEnvSecrets(ctx context.Context, id ExecutionId) (result JobExecutionListEnvSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listEnvSecrets", 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 + } + + var model EnvSecretsCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionslist.go new file mode 100644 index 00000000000..79627cedf18 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobexecutionslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 JobExecutionsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]JobExecution +} + +type JobExecutionsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []JobExecution +} + +type JobExecutionsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *JobExecutionsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// JobExecutionsList ... +func (c AppPlatformClient) JobExecutionsList(ctx context.Context, id JobId) (result JobExecutionsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &JobExecutionsListCustomPager{}, + Path: fmt.Sprintf("%s/executions", 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 *[]JobExecution `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// JobExecutionsListComplete retrieves all the results into a single object +func (c AppPlatformClient) JobExecutionsListComplete(ctx context.Context, id JobId) (JobExecutionsListCompleteResult, error) { + return c.JobExecutionsListCompleteMatchingPredicate(ctx, id, JobExecutionOperationPredicate{}) +} + +// JobExecutionsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) JobExecutionsListCompleteMatchingPredicate(ctx context.Context, id JobId, predicate JobExecutionOperationPredicate) (result JobExecutionsListCompleteResult, err error) { + items := make([]JobExecution, 0) + + resp, err := c.JobExecutionsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = JobExecutionsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobget.go new file mode 100644 index 00000000000..f786c851f9e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobget.go @@ -0,0 +1,53 @@ +package appplatform + +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 JobGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *JobResource +} + +// JobGet ... +func (c AppPlatformClient) JobGet(ctx context.Context, id JobId) (result JobGetOperationResponse, 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 + } + + var model JobResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_joblistenvsecrets.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_joblistenvsecrets.go new file mode 100644 index 00000000000..adf2e3385d8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_joblistenvsecrets.go @@ -0,0 +1,54 @@ +package appplatform + +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 JobListEnvSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EnvSecretsCollection +} + +// JobListEnvSecrets ... +func (c AppPlatformClient) JobListEnvSecrets(ctx context.Context, id JobId) (result JobListEnvSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listEnvSecrets", 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 + } + + var model EnvSecretsCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobslist.go new file mode 100644 index 00000000000..5e1e8b01be1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 JobsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]JobResource +} + +type JobsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []JobResource +} + +type JobsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *JobsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// JobsList ... +func (c AppPlatformClient) JobsList(ctx context.Context, id commonids.SpringCloudServiceId) (result JobsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &JobsListCustomPager{}, + Path: fmt.Sprintf("%s/jobs", 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 *[]JobResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// JobsListComplete retrieves all the results into a single object +func (c AppPlatformClient) JobsListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (JobsListCompleteResult, error) { + return c.JobsListCompleteMatchingPredicate(ctx, id, JobResourceOperationPredicate{}) +} + +// JobsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) JobsListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate JobResourceOperationPredicate) (result JobsListCompleteResult, err error) { + items := make([]JobResource, 0) + + resp, err := c.JobsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = JobsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobstart.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobstart.go new file mode 100644 index 00000000000..97ebd31ba3f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_jobstart.go @@ -0,0 +1,75 @@ +package appplatform + +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 JobStartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *JobExecution +} + +// JobStart ... +func (c AppPlatformClient) JobStart(ctx context.Context, id JobId, input JobExecutionTemplate) (result JobStartOperationResponse, 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 + } + + 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 +} + +// JobStartThenPoll performs JobStart then polls until it's completed +func (c AppPlatformClient) JobStartThenPoll(ctx context.Context, id JobId, input JobExecutionTemplate) error { + result, err := c.JobStart(ctx, id, input) + if err != nil { + return fmt.Errorf("performing JobStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after JobStart: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsget.go new file mode 100644 index 00000000000..0dcb42750cc --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsget.go @@ -0,0 +1,55 @@ +package appplatform + +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 MonitoringSettingsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MonitoringSettingResource +} + +// MonitoringSettingsGet ... +func (c AppPlatformClient) MonitoringSettingsGet(ctx context.Context, id commonids.SpringCloudServiceId) (result MonitoringSettingsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/monitoringSettings/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 + } + + var model MonitoringSettingResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdatepatch.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdatepatch.go new file mode 100644 index 00000000000..568deb4d382 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdatepatch.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettingsUpdatePatchOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *MonitoringSettingResource +} + +// MonitoringSettingsUpdatePatch ... +func (c AppPlatformClient) MonitoringSettingsUpdatePatch(ctx context.Context, id commonids.SpringCloudServiceId, input MonitoringSettingResource) (result MonitoringSettingsUpdatePatchOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/monitoringSettings/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 +} + +// MonitoringSettingsUpdatePatchThenPoll performs MonitoringSettingsUpdatePatch then polls until it's completed +func (c AppPlatformClient) MonitoringSettingsUpdatePatchThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input MonitoringSettingResource) error { + result, err := c.MonitoringSettingsUpdatePatch(ctx, id, input) + if err != nil { + return fmt.Errorf("performing MonitoringSettingsUpdatePatch: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after MonitoringSettingsUpdatePatch: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdateput.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdateput.go new file mode 100644 index 00000000000..63fdbc350b1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_monitoringsettingsupdateput.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettingsUpdatePutOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *MonitoringSettingResource +} + +// MonitoringSettingsUpdatePut ... +func (c AppPlatformClient) MonitoringSettingsUpdatePut(ctx context.Context, id commonids.SpringCloudServiceId, input MonitoringSettingResource) (result MonitoringSettingsUpdatePutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/monitoringSettings/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 +} + +// MonitoringSettingsUpdatePutThenPoll performs MonitoringSettingsUpdatePut then polls until it's completed +func (c AppPlatformClient) MonitoringSettingsUpdatePutThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input MonitoringSettingResource) error { + result, err := c.MonitoringSettingsUpdatePut(ctx, id, input) + if err != nil { + return fmt.Errorf("performing MonitoringSettingsUpdatePut: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after MonitoringSettingsUpdatePut: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsdisable.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsdisable.go new file mode 100644 index 00000000000..dd919341e79 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsdisable.go @@ -0,0 +1,70 @@ +package appplatform + +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 PredefinedAcceleratorsDisableOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PredefinedAcceleratorsDisable ... +func (c AppPlatformClient) PredefinedAcceleratorsDisable(ctx context.Context, id PredefinedAcceleratorId) (result PredefinedAcceleratorsDisableOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/disable", 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 +} + +// PredefinedAcceleratorsDisableThenPoll performs PredefinedAcceleratorsDisable then polls until it's completed +func (c AppPlatformClient) PredefinedAcceleratorsDisableThenPoll(ctx context.Context, id PredefinedAcceleratorId) error { + result, err := c.PredefinedAcceleratorsDisable(ctx, id) + if err != nil { + return fmt.Errorf("performing PredefinedAcceleratorsDisable: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PredefinedAcceleratorsDisable: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsenable.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsenable.go new file mode 100644 index 00000000000..10e40305bf8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsenable.go @@ -0,0 +1,70 @@ +package appplatform + +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 PredefinedAcceleratorsEnableOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PredefinedAcceleratorsEnable ... +func (c AppPlatformClient) PredefinedAcceleratorsEnable(ctx context.Context, id PredefinedAcceleratorId) (result PredefinedAcceleratorsEnableOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/enable", 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 +} + +// PredefinedAcceleratorsEnableThenPoll performs PredefinedAcceleratorsEnable then polls until it's completed +func (c AppPlatformClient) PredefinedAcceleratorsEnableThenPoll(ctx context.Context, id PredefinedAcceleratorId) error { + result, err := c.PredefinedAcceleratorsEnable(ctx, id) + if err != nil { + return fmt.Errorf("performing PredefinedAcceleratorsEnable: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PredefinedAcceleratorsEnable: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsget.go new file mode 100644 index 00000000000..91ada78ddf1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorsget.go @@ -0,0 +1,53 @@ +package appplatform + +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 PredefinedAcceleratorsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PredefinedAcceleratorResource +} + +// PredefinedAcceleratorsGet ... +func (c AppPlatformClient) PredefinedAcceleratorsGet(ctx context.Context, id PredefinedAcceleratorId) (result PredefinedAcceleratorsGetOperationResponse, 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 + } + + var model PredefinedAcceleratorResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorslist.go new file mode 100644 index 00000000000..79161cb1d5b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_predefinedacceleratorslist.go @@ -0,0 +1,105 @@ +package appplatform + +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 PredefinedAcceleratorsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PredefinedAcceleratorResource +} + +type PredefinedAcceleratorsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []PredefinedAcceleratorResource +} + +type PredefinedAcceleratorsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *PredefinedAcceleratorsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// PredefinedAcceleratorsList ... +func (c AppPlatformClient) PredefinedAcceleratorsList(ctx context.Context, id ApplicationAcceleratorId) (result PredefinedAcceleratorsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &PredefinedAcceleratorsListCustomPager{}, + Path: fmt.Sprintf("%s/predefinedAccelerators", 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 *[]PredefinedAcceleratorResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// PredefinedAcceleratorsListComplete retrieves all the results into a single object +func (c AppPlatformClient) PredefinedAcceleratorsListComplete(ctx context.Context, id ApplicationAcceleratorId) (PredefinedAcceleratorsListCompleteResult, error) { + return c.PredefinedAcceleratorsListCompleteMatchingPredicate(ctx, id, PredefinedAcceleratorResourceOperationPredicate{}) +} + +// PredefinedAcceleratorsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) PredefinedAcceleratorsListCompleteMatchingPredicate(ctx context.Context, id ApplicationAcceleratorId, predicate PredefinedAcceleratorResourceOperationPredicate) (result PredefinedAcceleratorsListCompleteResult, err error) { + items := make([]PredefinedAcceleratorResource, 0) + + resp, err := c.PredefinedAcceleratorsList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = PredefinedAcceleratorsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_runtimeversionslistruntimeversions.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_runtimeversionslistruntimeversions.go new file mode 100644 index 00000000000..81408df96f0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_runtimeversionslistruntimeversions.go @@ -0,0 +1,53 @@ +package appplatform + +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 RuntimeVersionsListRuntimeVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailableRuntimeVersions +} + +// RuntimeVersionsListRuntimeVersions ... +func (c AppPlatformClient) RuntimeVersionsListRuntimeVersions(ctx context.Context) (result RuntimeVersionsListRuntimeVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: "/providers/Microsoft.AppPlatform/runtimeVersions", + } + + 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 + } + + var model AvailableRuntimeVersions + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriescreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriescreateorupdate.go new file mode 100644 index 00000000000..2a7e6e36f94 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriescreateorupdate.go @@ -0,0 +1,71 @@ +package appplatform + +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 ServiceRegistriesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ServiceRegistryResource +} + +// ServiceRegistriesCreateOrUpdate ... +func (c AppPlatformClient) ServiceRegistriesCreateOrUpdate(ctx context.Context, id ServiceRegistryId) (result ServiceRegistriesCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + 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 +} + +// ServiceRegistriesCreateOrUpdateThenPoll performs ServiceRegistriesCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ServiceRegistriesCreateOrUpdateThenPoll(ctx context.Context, id ServiceRegistryId) error { + result, err := c.ServiceRegistriesCreateOrUpdate(ctx, id) + if err != nil { + return fmt.Errorf("performing ServiceRegistriesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServiceRegistriesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesdelete.go new file mode 100644 index 00000000000..147e74dffb4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 ServiceRegistriesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServiceRegistriesDelete ... +func (c AppPlatformClient) ServiceRegistriesDelete(ctx context.Context, id ServiceRegistryId) (result ServiceRegistriesDeleteOperationResponse, 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 +} + +// ServiceRegistriesDeleteThenPoll performs ServiceRegistriesDelete then polls until it's completed +func (c AppPlatformClient) ServiceRegistriesDeleteThenPoll(ctx context.Context, id ServiceRegistryId) error { + result, err := c.ServiceRegistriesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ServiceRegistriesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServiceRegistriesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesget.go new file mode 100644 index 00000000000..0259bd789c9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistriesget.go @@ -0,0 +1,53 @@ +package appplatform + +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 ServiceRegistriesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ServiceRegistryResource +} + +// ServiceRegistriesGet ... +func (c AppPlatformClient) ServiceRegistriesGet(ctx context.Context, id ServiceRegistryId) (result ServiceRegistriesGetOperationResponse, 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 + } + + var model ServiceRegistryResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistrieslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistrieslist.go new file mode 100644 index 00000000000..cd292429174 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceregistrieslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ServiceRegistriesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ServiceRegistryResource +} + +type ServiceRegistriesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ServiceRegistryResource +} + +type ServiceRegistriesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ServiceRegistriesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ServiceRegistriesList ... +func (c AppPlatformClient) ServiceRegistriesList(ctx context.Context, id commonids.SpringCloudServiceId) (result ServiceRegistriesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ServiceRegistriesListCustomPager{}, + Path: fmt.Sprintf("%s/serviceRegistries", 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 *[]ServiceRegistryResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ServiceRegistriesListComplete retrieves all the results into a single object +func (c AppPlatformClient) ServiceRegistriesListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ServiceRegistriesListCompleteResult, error) { + return c.ServiceRegistriesListCompleteMatchingPredicate(ctx, id, ServiceRegistryResourceOperationPredicate{}) +} + +// ServiceRegistriesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ServiceRegistriesListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate ServiceRegistryResourceOperationPredicate) (result ServiceRegistriesListCompleteResult, err error) { + items := make([]ServiceRegistryResource, 0) + + resp, err := c.ServiceRegistriesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ServiceRegistriesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceschecknameavailability.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceschecknameavailability.go new file mode 100644 index 00000000000..c43d41eefa6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceschecknameavailability.go @@ -0,0 +1,58 @@ +package appplatform + +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 ServicesCheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NameAvailability +} + +// ServicesCheckNameAvailability ... +func (c AppPlatformClient) ServicesCheckNameAvailability(ctx context.Context, id LocationId, input NameAvailabilityParameters) (result ServicesCheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/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 + } + + var model NameAvailability + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicescreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicescreateorupdate.go new file mode 100644 index 00000000000..64142f7d372 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicescreateorupdate.go @@ -0,0 +1,77 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ServiceResource +} + +// ServicesCreateOrUpdate ... +func (c AppPlatformClient) ServicesCreateOrUpdate(ctx context.Context, id commonids.SpringCloudServiceId, input ServiceResource) (result ServicesCreateOrUpdateOperationResponse, 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 +} + +// ServicesCreateOrUpdateThenPoll performs ServicesCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) ServicesCreateOrUpdateThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ServiceResource) error { + result, err := c.ServicesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServicesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdelete.go new file mode 100644 index 00000000000..13c1f5c2310 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdelete.go @@ -0,0 +1,72 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesDelete ... +func (c AppPlatformClient) ServicesDelete(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesDeleteOperationResponse, 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 +} + +// ServicesDeleteThenPoll performs ServicesDelete then polls until it's completed +func (c AppPlatformClient) ServicesDeleteThenPoll(ctx context.Context, id commonids.SpringCloudServiceId) error { + result, err := c.ServicesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ServicesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisableapmglobally.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisableapmglobally.go new file mode 100644 index 00000000000..a6afd34f59d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisableapmglobally.go @@ -0,0 +1,75 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesDisableApmGloballyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesDisableApmGlobally ... +func (c AppPlatformClient) ServicesDisableApmGlobally(ctx context.Context, id commonids.SpringCloudServiceId, input ApmReference) (result ServicesDisableApmGloballyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/disableApmGlobally", 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 +} + +// ServicesDisableApmGloballyThenPoll performs ServicesDisableApmGlobally then polls until it's completed +func (c AppPlatformClient) ServicesDisableApmGloballyThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ApmReference) error { + result, err := c.ServicesDisableApmGlobally(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServicesDisableApmGlobally: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesDisableApmGlobally: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisabletestendpoint.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisabletestendpoint.go new file mode 100644 index 00000000000..9ad7975e433 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesdisabletestendpoint.go @@ -0,0 +1,48 @@ +package appplatform + +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 ServicesDisableTestEndpointOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesDisableTestEndpoint ... +func (c AppPlatformClient) ServicesDisableTestEndpoint(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesDisableTestEndpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/disableTestEndpoint", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenableapmglobally.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenableapmglobally.go new file mode 100644 index 00000000000..8a233616070 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenableapmglobally.go @@ -0,0 +1,75 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesEnableApmGloballyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesEnableApmGlobally ... +func (c AppPlatformClient) ServicesEnableApmGlobally(ctx context.Context, id commonids.SpringCloudServiceId, input ApmReference) (result ServicesEnableApmGloballyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/enableApmGlobally", 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 +} + +// ServicesEnableApmGloballyThenPoll performs ServicesEnableApmGlobally then polls until it's completed +func (c AppPlatformClient) ServicesEnableApmGloballyThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ApmReference) error { + result, err := c.ServicesEnableApmGlobally(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServicesEnableApmGlobally: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesEnableApmGlobally: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenabletestendpoint.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenabletestendpoint.go new file mode 100644 index 00000000000..1df588bc859 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesenabletestendpoint.go @@ -0,0 +1,55 @@ +package appplatform + +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 ServicesEnableTestEndpointOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TestKeys +} + +// ServicesEnableTestEndpoint ... +func (c AppPlatformClient) ServicesEnableTestEndpoint(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesEnableTestEndpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/enableTestEndpoint", 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 + } + + var model TestKeys + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesflushvnetdnssetting.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesflushvnetdnssetting.go new file mode 100644 index 00000000000..8063c7a263f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesflushvnetdnssetting.go @@ -0,0 +1,70 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesFlushVnetDnsSettingOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesFlushVnetDnsSetting ... +func (c AppPlatformClient) ServicesFlushVnetDnsSetting(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesFlushVnetDnsSettingOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/flushVirtualNetworkDnsSettings", 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 +} + +// ServicesFlushVnetDnsSettingThenPoll performs ServicesFlushVnetDnsSetting then polls until it's completed +func (c AppPlatformClient) ServicesFlushVnetDnsSettingThenPoll(ctx context.Context, id commonids.SpringCloudServiceId) error { + result, err := c.ServicesFlushVnetDnsSetting(ctx, id) + if err != nil { + return fmt.Errorf("performing ServicesFlushVnetDnsSetting: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesFlushVnetDnsSetting: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesget.go new file mode 100644 index 00000000000..cc3d2a0cae2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesget.go @@ -0,0 +1,54 @@ +package appplatform + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ServiceResource +} + +// ServicesGet ... +func (c AppPlatformClient) ServicesGet(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesGetOperationResponse, 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 + } + + var model ServiceResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslist.go new file mode 100644 index 00000000000..32848608e2d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 ServicesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ServiceResource +} + +type ServicesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ServiceResource +} + +type ServicesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ServicesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ServicesList ... +func (c AppPlatformClient) ServicesList(ctx context.Context, id commonids.ResourceGroupId) (result ServicesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ServicesListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.AppPlatform/spring", 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 *[]ServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ServicesListComplete retrieves all the results into a single object +func (c AppPlatformClient) ServicesListComplete(ctx context.Context, id commonids.ResourceGroupId) (ServicesListCompleteResult, error) { + return c.ServicesListCompleteMatchingPredicate(ctx, id, ServiceResourceOperationPredicate{}) +} + +// ServicesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ServicesListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ServiceResourceOperationPredicate) (result ServicesListCompleteResult, err error) { + items := make([]ServiceResource, 0) + + resp, err := c.ServicesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ServicesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistbysubscription.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistbysubscription.go new file mode 100644 index 00000000000..c0a0fe2ea94 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistbysubscription.go @@ -0,0 +1,106 @@ +package appplatform + +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 ServicesListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ServiceResource +} + +type ServicesListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ServiceResource +} + +type ServicesListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ServicesListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ServicesListBySubscription ... +func (c AppPlatformClient) ServicesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ServicesListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ServicesListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.AppPlatform/spring", 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 *[]ServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ServicesListBySubscriptionComplete retrieves all the results into a single object +func (c AppPlatformClient) ServicesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ServicesListBySubscriptionCompleteResult, error) { + return c.ServicesListBySubscriptionCompleteMatchingPredicate(ctx, id, ServiceResourceOperationPredicate{}) +} + +// ServicesListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ServicesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ServiceResourceOperationPredicate) (result ServicesListBySubscriptionCompleteResult, err error) { + items := make([]ServiceResource, 0) + + resp, err := c.ServicesListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ServicesListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistgloballyenabledapms.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistgloballyenabledapms.go new file mode 100644 index 00000000000..262011227cf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistgloballyenabledapms.go @@ -0,0 +1,55 @@ +package appplatform + +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 ServicesListGloballyEnabledApmsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GloballyEnabledApms +} + +// ServicesListGloballyEnabledApms ... +func (c AppPlatformClient) ServicesListGloballyEnabledApms(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesListGloballyEnabledApmsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listGloballyEnabledApms", 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 + } + + var model GloballyEnabledApms + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedapmtypes.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedapmtypes.go new file mode 100644 index 00000000000..460a4047eec --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedapmtypes.go @@ -0,0 +1,106 @@ +package appplatform + +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 ServicesListSupportedApmTypesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SupportedApmType +} + +type ServicesListSupportedApmTypesCompleteResult struct { + LatestHttpResponse *http.Response + Items []SupportedApmType +} + +type ServicesListSupportedApmTypesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ServicesListSupportedApmTypesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ServicesListSupportedApmTypes ... +func (c AppPlatformClient) ServicesListSupportedApmTypes(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesListSupportedApmTypesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ServicesListSupportedApmTypesCustomPager{}, + Path: fmt.Sprintf("%s/supportedApmTypes", 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 *[]SupportedApmType `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ServicesListSupportedApmTypesComplete retrieves all the results into a single object +func (c AppPlatformClient) ServicesListSupportedApmTypesComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ServicesListSupportedApmTypesCompleteResult, error) { + return c.ServicesListSupportedApmTypesCompleteMatchingPredicate(ctx, id, SupportedApmTypeOperationPredicate{}) +} + +// ServicesListSupportedApmTypesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ServicesListSupportedApmTypesCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate SupportedApmTypeOperationPredicate) (result ServicesListSupportedApmTypesCompleteResult, err error) { + items := make([]SupportedApmType, 0) + + resp, err := c.ServicesListSupportedApmTypes(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ServicesListSupportedApmTypesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedserverversions.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedserverversions.go new file mode 100644 index 00000000000..373e33bd438 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslistsupportedserverversions.go @@ -0,0 +1,106 @@ +package appplatform + +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 ServicesListSupportedServerVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SupportedServerVersion +} + +type ServicesListSupportedServerVersionsCompleteResult struct { + LatestHttpResponse *http.Response + Items []SupportedServerVersion +} + +type ServicesListSupportedServerVersionsCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ServicesListSupportedServerVersionsCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ServicesListSupportedServerVersions ... +func (c AppPlatformClient) ServicesListSupportedServerVersions(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesListSupportedServerVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ServicesListSupportedServerVersionsCustomPager{}, + Path: fmt.Sprintf("%s/supportedServerVersions", 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 *[]SupportedServerVersion `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ServicesListSupportedServerVersionsComplete retrieves all the results into a single object +func (c AppPlatformClient) ServicesListSupportedServerVersionsComplete(ctx context.Context, id commonids.SpringCloudServiceId) (ServicesListSupportedServerVersionsCompleteResult, error) { + return c.ServicesListSupportedServerVersionsCompleteMatchingPredicate(ctx, id, SupportedServerVersionOperationPredicate{}) +} + +// ServicesListSupportedServerVersionsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) ServicesListSupportedServerVersionsCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate SupportedServerVersionOperationPredicate) (result ServicesListSupportedServerVersionsCompleteResult, err error) { + items := make([]SupportedServerVersion, 0) + + resp, err := c.ServicesListSupportedServerVersions(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ServicesListSupportedServerVersionsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslisttestkeys.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslisttestkeys.go new file mode 100644 index 00000000000..7ccfa6d9aa4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_serviceslisttestkeys.go @@ -0,0 +1,55 @@ +package appplatform + +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 ServicesListTestKeysOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TestKeys +} + +// ServicesListTestKeys ... +func (c AppPlatformClient) ServicesListTestKeys(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesListTestKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listTestKeys", 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 + } + + var model TestKeys + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesregeneratetestkey.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesregeneratetestkey.go new file mode 100644 index 00000000000..f83c2cf2c59 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesregeneratetestkey.go @@ -0,0 +1,59 @@ +package appplatform + +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 ServicesRegenerateTestKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TestKeys +} + +// ServicesRegenerateTestKey ... +func (c AppPlatformClient) ServicesRegenerateTestKey(ctx context.Context, id commonids.SpringCloudServiceId, input RegenerateTestKeyRequestPayload) (result ServicesRegenerateTestKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateTestKey", 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 + } + + var model TestKeys + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstart.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstart.go new file mode 100644 index 00000000000..e75395ee4b3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstart.go @@ -0,0 +1,70 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesStartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesStart ... +func (c AppPlatformClient) ServicesStart(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesStartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + 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 +} + +// ServicesStartThenPoll performs ServicesStart then polls until it's completed +func (c AppPlatformClient) ServicesStartThenPoll(ctx context.Context, id commonids.SpringCloudServiceId) error { + result, err := c.ServicesStart(ctx, id) + if err != nil { + return fmt.Errorf("performing ServicesStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesStart: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstop.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstop.go new file mode 100644 index 00000000000..8733ffd5724 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesstop.go @@ -0,0 +1,70 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesStopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ServicesStop ... +func (c AppPlatformClient) ServicesStop(ctx context.Context, id commonids.SpringCloudServiceId) (result ServicesStopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + 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 +} + +// ServicesStopThenPoll performs ServicesStop then polls until it's completed +func (c AppPlatformClient) ServicesStopThenPoll(ctx context.Context, id commonids.SpringCloudServiceId) error { + result, err := c.ServicesStop(ctx, id) + if err != nil { + return fmt.Errorf("performing ServicesStop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesStop: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesupdate.go new file mode 100644 index 00000000000..f30488a7c1c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_servicesupdate.go @@ -0,0 +1,76 @@ +package appplatform + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ServiceResource +} + +// ServicesUpdate ... +func (c AppPlatformClient) ServicesUpdate(ctx context.Context, id commonids.SpringCloudServiceId, input ServiceResource) (result ServicesUpdateOperationResponse, 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 +} + +// ServicesUpdateThenPoll performs ServicesUpdate then polls until it's completed +func (c AppPlatformClient) ServicesUpdateThenPoll(ctx context.Context, id commonids.SpringCloudServiceId, input ServiceResource) error { + result, err := c.ServicesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServicesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ServicesUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_skuslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_skuslist.go new file mode 100644 index 00000000000..7e6ba03c914 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_skuslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 SkusListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResourceSku +} + +type SkusListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ResourceSku +} + +type SkusListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *SkusListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// SkusList ... +func (c AppPlatformClient) SkusList(ctx context.Context, id commonids.SubscriptionId) (result SkusListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &SkusListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.AppPlatform/skus", 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 *[]ResourceSku `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// SkusListComplete retrieves all the results into a single object +func (c AppPlatformClient) SkusListComplete(ctx context.Context, id commonids.SubscriptionId) (SkusListCompleteResult, error) { + return c.SkusListCompleteMatchingPredicate(ctx, id, ResourceSkuOperationPredicate{}) +} + +// SkusListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) SkusListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ResourceSkuOperationPredicate) (result SkusListCompleteResult, err error) { + items := make([]ResourceSku, 0) + + resp, err := c.SkusList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = SkusListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagescreateorupdate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagescreateorupdate.go new file mode 100644 index 00000000000..a9557deff9c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagescreateorupdate.go @@ -0,0 +1,76 @@ +package appplatform + +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 StoragesCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *StorageResource +} + +// StoragesCreateOrUpdate ... +func (c AppPlatformClient) StoragesCreateOrUpdate(ctx context.Context, id StorageId, input StorageResource) (result StoragesCreateOrUpdateOperationResponse, 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 +} + +// StoragesCreateOrUpdateThenPoll performs StoragesCreateOrUpdate then polls until it's completed +func (c AppPlatformClient) StoragesCreateOrUpdateThenPoll(ctx context.Context, id StorageId, input StorageResource) error { + result, err := c.StoragesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing StoragesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StoragesCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesdelete.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesdelete.go new file mode 100644 index 00000000000..77a32530ec3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesdelete.go @@ -0,0 +1,71 @@ +package appplatform + +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 StoragesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// StoragesDelete ... +func (c AppPlatformClient) StoragesDelete(ctx context.Context, id StorageId) (result StoragesDeleteOperationResponse, 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 +} + +// StoragesDeleteThenPoll performs StoragesDelete then polls until it's completed +func (c AppPlatformClient) StoragesDeleteThenPoll(ctx context.Context, id StorageId) error { + result, err := c.StoragesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing StoragesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StoragesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesget.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesget.go new file mode 100644 index 00000000000..8e3bc1508f9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storagesget.go @@ -0,0 +1,53 @@ +package appplatform + +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 StoragesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *StorageResource +} + +// StoragesGet ... +func (c AppPlatformClient) StoragesGet(ctx context.Context, id StorageId) (result StoragesGetOperationResponse, 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 + } + + var model StorageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storageslist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storageslist.go new file mode 100644 index 00000000000..56bdf56e72a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/method_storageslist.go @@ -0,0 +1,106 @@ +package appplatform + +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 StoragesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]StorageResource +} + +type StoragesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []StorageResource +} + +type StoragesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *StoragesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// StoragesList ... +func (c AppPlatformClient) StoragesList(ctx context.Context, id commonids.SpringCloudServiceId) (result StoragesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &StoragesListCustomPager{}, + Path: fmt.Sprintf("%s/storages", 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 *[]StorageResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// StoragesListComplete retrieves all the results into a single object +func (c AppPlatformClient) StoragesListComplete(ctx context.Context, id commonids.SpringCloudServiceId) (StoragesListCompleteResult, error) { + return c.StoragesListCompleteMatchingPredicate(ctx, id, StorageResourceOperationPredicate{}) +} + +// StoragesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AppPlatformClient) StoragesListCompleteMatchingPredicate(ctx context.Context, id commonids.SpringCloudServiceId, predicate StorageResourceOperationPredicate) (result StoragesListCompleteResult, err error) { + items := make([]StorageResource, 0) + + resp, err := c.StoragesList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = StoragesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorauthsetting.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorauthsetting.go new file mode 100644 index 00000000000..5f33dd8752e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorauthsetting.go @@ -0,0 +1,91 @@ +package appplatform + +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 AcceleratorAuthSetting interface { + AcceleratorAuthSetting() BaseAcceleratorAuthSettingImpl +} + +var _ AcceleratorAuthSetting = BaseAcceleratorAuthSettingImpl{} + +type BaseAcceleratorAuthSettingImpl struct { + AuthType string `json:"authType"` +} + +func (s BaseAcceleratorAuthSettingImpl) AcceleratorAuthSetting() BaseAcceleratorAuthSettingImpl { + return s +} + +var _ AcceleratorAuthSetting = RawAcceleratorAuthSettingImpl{} + +// RawAcceleratorAuthSettingImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawAcceleratorAuthSettingImpl struct { + acceleratorAuthSetting BaseAcceleratorAuthSettingImpl + Type string + Values map[string]interface{} +} + +func (s RawAcceleratorAuthSettingImpl) AcceleratorAuthSetting() BaseAcceleratorAuthSettingImpl { + return s.acceleratorAuthSetting +} + +func UnmarshalAcceleratorAuthSettingImplementation(input []byte) (AcceleratorAuthSetting, 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 AcceleratorAuthSetting into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["authType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "BasicAuth") { + var out AcceleratorBasicAuthSetting + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AcceleratorBasicAuthSetting: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Public") { + var out AcceleratorPublicSetting + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AcceleratorPublicSetting: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SSH") { + var out AcceleratorSshSetting + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AcceleratorSshSetting: %+v", err) + } + return out, nil + } + + var parent BaseAcceleratorAuthSettingImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseAcceleratorAuthSettingImpl: %+v", err) + } + + return RawAcceleratorAuthSettingImpl{ + acceleratorAuthSetting: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorbasicauthsetting.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorbasicauthsetting.go new file mode 100644 index 00000000000..c8a4ac5dfdf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorbasicauthsetting.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ AcceleratorAuthSetting = AcceleratorBasicAuthSetting{} + +type AcceleratorBasicAuthSetting struct { + CaCertResourceId *string `json:"caCertResourceId,omitempty"` + Password *string `json:"password,omitempty"` + Username string `json:"username"` + + // Fields inherited from AcceleratorAuthSetting + + AuthType string `json:"authType"` +} + +func (s AcceleratorBasicAuthSetting) AcceleratorAuthSetting() BaseAcceleratorAuthSettingImpl { + return BaseAcceleratorAuthSettingImpl{ + AuthType: s.AuthType, + } +} + +var _ json.Marshaler = AcceleratorBasicAuthSetting{} + +func (s AcceleratorBasicAuthSetting) MarshalJSON() ([]byte, error) { + type wrapper AcceleratorBasicAuthSetting + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AcceleratorBasicAuthSetting: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AcceleratorBasicAuthSetting: %+v", err) + } + + decoded["authType"] = "BasicAuth" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AcceleratorBasicAuthSetting: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorgitrepository.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorgitrepository.go new file mode 100644 index 00000000000..fa1136494a3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorgitrepository.go @@ -0,0 +1,57 @@ +package appplatform + +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. + +type AcceleratorGitRepository struct { + AuthSetting AcceleratorAuthSetting `json:"authSetting"` + Branch *string `json:"branch,omitempty"` + Commit *string `json:"commit,omitempty"` + GitTag *string `json:"gitTag,omitempty"` + IntervalInSeconds *int64 `json:"intervalInSeconds,omitempty"` + SubPath *string `json:"subPath,omitempty"` + Url string `json:"url"` +} + +var _ json.Unmarshaler = &AcceleratorGitRepository{} + +func (s *AcceleratorGitRepository) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Branch *string `json:"branch,omitempty"` + Commit *string `json:"commit,omitempty"` + GitTag *string `json:"gitTag,omitempty"` + IntervalInSeconds *int64 `json:"intervalInSeconds,omitempty"` + SubPath *string `json:"subPath,omitempty"` + Url string `json:"url"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Branch = decoded.Branch + s.Commit = decoded.Commit + s.GitTag = decoded.GitTag + s.IntervalInSeconds = decoded.IntervalInSeconds + s.SubPath = decoded.SubPath + s.Url = decoded.Url + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AcceleratorGitRepository into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["authSetting"]; ok { + impl, err := UnmarshalAcceleratorAuthSettingImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'AuthSetting' for 'AcceleratorGitRepository': %+v", err) + } + s.AuthSetting = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorpublicsetting.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorpublicsetting.go new file mode 100644 index 00000000000..ceddf807fd1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorpublicsetting.go @@ -0,0 +1,50 @@ +package appplatform + +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 _ AcceleratorAuthSetting = AcceleratorPublicSetting{} + +type AcceleratorPublicSetting struct { + CaCertResourceId *string `json:"caCertResourceId,omitempty"` + + // Fields inherited from AcceleratorAuthSetting + + AuthType string `json:"authType"` +} + +func (s AcceleratorPublicSetting) AcceleratorAuthSetting() BaseAcceleratorAuthSettingImpl { + return BaseAcceleratorAuthSettingImpl{ + AuthType: s.AuthType, + } +} + +var _ json.Marshaler = AcceleratorPublicSetting{} + +func (s AcceleratorPublicSetting) MarshalJSON() ([]byte, error) { + type wrapper AcceleratorPublicSetting + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AcceleratorPublicSetting: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AcceleratorPublicSetting: %+v", err) + } + + decoded["authType"] = "Public" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AcceleratorPublicSetting: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorsshsetting.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorsshsetting.go new file mode 100644 index 00000000000..9206fb45e17 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_acceleratorsshsetting.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ AcceleratorAuthSetting = AcceleratorSshSetting{} + +type AcceleratorSshSetting struct { + HostKey *string `json:"hostKey,omitempty"` + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + PrivateKey *string `json:"privateKey,omitempty"` + + // Fields inherited from AcceleratorAuthSetting + + AuthType string `json:"authType"` +} + +func (s AcceleratorSshSetting) AcceleratorAuthSetting() BaseAcceleratorAuthSettingImpl { + return BaseAcceleratorAuthSettingImpl{ + AuthType: s.AuthType, + } +} + +var _ json.Marshaler = AcceleratorSshSetting{} + +func (s AcceleratorSshSetting) MarshalJSON() ([]byte, error) { + type wrapper AcceleratorSshSetting + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AcceleratorSshSetting: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AcceleratorSshSetting: %+v", err) + } + + decoded["authType"] = "SSH" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AcceleratorSshSetting: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_activedeploymentcollection.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_activedeploymentcollection.go new file mode 100644 index 00000000000..76114f30f50 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_activedeploymentcollection.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveDeploymentCollection struct { + ActiveDeploymentNames *[]string `json:"activeDeploymentNames,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainproperties.go new file mode 100644 index 00000000000..fa67fc3ac50 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainproperties.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalCustomDomainProperties struct { + Thumbprint *string `json:"thumbprint,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainresource.go new file mode 100644 index 00000000000..95465bb1983 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalcustomdomainresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalCustomDomainResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiPortalCustomDomainProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalinstance.go new file mode 100644 index 00000000000..e9e2614923b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalproperties.go new file mode 100644 index 00000000000..8f9635a372e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalproperties.go @@ -0,0 +1,17 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalProperties struct { + ApiTryOutEnabledState *ApiPortalApiTryOutEnabledState `json:"apiTryOutEnabledState,omitempty"` + GatewayIds *[]string `json:"gatewayIds,omitempty"` + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + Instances *[]ApiPortalInstance `json:"instances,omitempty"` + ProvisioningState *ApiPortalProvisioningState `json:"provisioningState,omitempty"` + Public *bool `json:"public,omitempty"` + ResourceRequests *ApiPortalResourceRequests `json:"resourceRequests,omitempty"` + SourceURLs *[]string `json:"sourceUrls,omitempty"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresource.go new file mode 100644 index 00000000000..9902c67d6d7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresource.go @@ -0,0 +1,17 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApiPortalProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresourcerequests.go new file mode 100644 index 00000000000..45f9885cc64 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apiportalresourcerequests.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmproperties.go new file mode 100644 index 00000000000..526b061df7d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmproperties.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApmProperties struct { + Properties *map[string]string `json:"properties,omitempty"` + ProvisioningState *ApmProvisioningState `json:"provisioningState,omitempty"` + Secrets *map[string]string `json:"secrets,omitempty"` + Type string `json:"type"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmreference.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmreference.go new file mode 100644 index 00000000000..a641ae501f6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmreference.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApmReference struct { + ResourceId string `json:"resourceId"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmresource.go new file mode 100644 index 00000000000..72e79bc0a1e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApmResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApmProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmsecretkeys.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmsecretkeys.go new file mode 100644 index 00000000000..3b23532f46f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_apmsecretkeys.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApmSecretKeys struct { + Value *[]string `json:"value,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorcomponent.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorcomponent.go new file mode 100644 index 00000000000..96286a73270 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorcomponent.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAcceleratorComponent struct { + Instances *[]ApplicationAcceleratorInstance `json:"instances,omitempty"` + Name *string `json:"name,omitempty"` + ResourceRequests *ApplicationAcceleratorResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorinstance.go new file mode 100644 index 00000000000..70b09a93392 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAcceleratorInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorproperties.go new file mode 100644 index 00000000000..1af4f2f10be --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAcceleratorProperties struct { + Components *[]ApplicationAcceleratorComponent `json:"components,omitempty"` + ProvisioningState *ApplicationAcceleratorProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresource.go new file mode 100644 index 00000000000..12098d9b12e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresource.go @@ -0,0 +1,17 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAcceleratorResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApplicationAcceleratorProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresourcerequests.go new file mode 100644 index 00000000000..d134a20fc99 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationacceleratorresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationAcceleratorResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationinsightsagentversions.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationinsightsagentversions.go new file mode 100644 index 00000000000..154d2c1477b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationinsightsagentversions.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsAgentVersions struct { + Java *string `json:"java,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewcomponent.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewcomponent.go new file mode 100644 index 00000000000..c064fde6d7a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewcomponent.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationLiveViewComponent struct { + Instances *[]ApplicationLiveViewInstance `json:"instances,omitempty"` + Name *interface{} `json:"name,omitempty"` + ResourceRequests *ApplicationLiveViewResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewinstance.go new file mode 100644 index 00000000000..1636412b5ae --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationLiveViewInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewproperties.go new file mode 100644 index 00000000000..6782d1e5065 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationLiveViewProperties struct { + Components *[]ApplicationLiveViewComponent `json:"components,omitempty"` + ProvisioningState *ApplicationLiveViewProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresource.go new file mode 100644 index 00000000000..f461efed664 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationLiveViewResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApplicationLiveViewProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresourcerequests.go new file mode 100644 index 00000000000..1d1e3f8f1a8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_applicationliveviewresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationLiveViewResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresource.go new file mode 100644 index 00000000000..a192f643cae --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresource.go @@ -0,0 +1,19 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppResource struct { + Id *string `json:"id,omitempty"` + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AppResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresourceproperties.go new file mode 100644 index 00000000000..39a46c91cc0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appresourceproperties.go @@ -0,0 +1,23 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppResourceProperties struct { + AddonConfigs *map[string]interface{} `json:"addonConfigs,omitempty"` + CustomPersistentDisks *[]CustomPersistentDiskResource `json:"customPersistentDisks,omitempty"` + EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + IngressSettings *IngressSettings `json:"ingressSettings,omitempty"` + LoadedCertificates *[]LoadedCertificate `json:"loadedCertificates,omitempty"` + PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` + ProvisioningState *AppResourceProvisioningState `json:"provisioningState,omitempty"` + Public *bool `json:"public,omitempty"` + Secrets *[]Secret `json:"secrets,omitempty"` + TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` + TestEndpointAuthState *TestEndpointAuthState `json:"testEndpointAuthState,omitempty"` + Url *string `json:"url,omitempty"` + VnetAddons *AppVNetAddons `json:"vnetAddons,omitempty"` + WorkloadProfileName *string `json:"workloadProfileName,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appvnetaddons.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appvnetaddons.go new file mode 100644 index 00000000000..58649ca7840 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_appvnetaddons.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppVNetAddons struct { + PublicEndpoint *bool `json:"publicEndpoint,omitempty"` + PublicEndpointURL *string `json:"publicEndpointUrl,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_availableruntimeversions.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_availableruntimeversions.go new file mode 100644 index 00000000000..fd5ac242c74 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_availableruntimeversions.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailableRuntimeVersions struct { + Value *[]SupportedRuntimeVersion `json:"value,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_azurefilevolume.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_azurefilevolume.go new file mode 100644 index 00000000000..a8d1838313a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_azurefilevolume.go @@ -0,0 +1,58 @@ +package appplatform + +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 _ CustomPersistentDiskProperties = AzureFileVolume{} + +type AzureFileVolume struct { + ShareName *string `json:"shareName,omitempty"` + + // Fields inherited from CustomPersistentDiskProperties + + EnableSubPath *bool `json:"enableSubPath,omitempty"` + MountOptions *[]string `json:"mountOptions,omitempty"` + MountPath string `json:"mountPath"` + ReadOnly *bool `json:"readOnly,omitempty"` + Type Type `json:"type"` +} + +func (s AzureFileVolume) CustomPersistentDiskProperties() BaseCustomPersistentDiskPropertiesImpl { + return BaseCustomPersistentDiskPropertiesImpl{ + EnableSubPath: s.EnableSubPath, + MountOptions: s.MountOptions, + MountPath: s.MountPath, + ReadOnly: s.ReadOnly, + Type: s.Type, + } +} + +var _ json.Marshaler = AzureFileVolume{} + +func (s AzureFileVolume) MarshalJSON() ([]byte, error) { + type wrapper AzureFileVolume + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureFileVolume: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureFileVolume: %+v", err) + } + + decoded["type"] = "AzureFileVolume" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureFileVolume: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresource.go new file mode 100644 index 00000000000..ca9f21a1c01 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BindingResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BindingResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresourceproperties.go new file mode 100644 index 00000000000..abce68a17b9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_bindingresourceproperties.go @@ -0,0 +1,15 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BindingResourceProperties struct { + BindingParameters *map[string]string `json:"bindingParameters,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + GeneratedProperties *string `json:"generatedProperties,omitempty"` + Key *string `json:"key,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_build.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_build.go new file mode 100644 index 00000000000..bd160974233 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_build.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Build struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BuildProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderproperties.go new file mode 100644 index 00000000000..cb3c692584d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderproperties.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuilderProperties struct { + BuildpackGroups *[]BuildpacksGroupProperties `json:"buildpackGroups,omitempty"` + ProvisioningState *BuilderProvisioningState `json:"provisioningState,omitempty"` + Stack *StackProperties `json:"stack,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderresource.go new file mode 100644 index 00000000000..8462dfdd37e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_builderresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuilderResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BuilderProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindinglaunchproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindinglaunchproperties.go new file mode 100644 index 00000000000..254a769dd3f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindinglaunchproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildpackBindingLaunchProperties struct { + Properties *map[string]string `json:"properties,omitempty"` + Secrets *map[string]string `json:"secrets,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingproperties.go new file mode 100644 index 00000000000..fad1a4a6f5c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingproperties.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildpackBindingProperties struct { + BindingType *BindingType `json:"bindingType,omitempty"` + LaunchProperties *BuildpackBindingLaunchProperties `json:"launchProperties,omitempty"` + ProvisioningState *BuildpackBindingProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingresource.go new file mode 100644 index 00000000000..ae0cf6904df --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackbindingresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildpackBindingResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BuildpackBindingProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackproperties.go new file mode 100644 index 00000000000..a401a5608b6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpackproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildpackProperties struct { + Id *string `json:"id,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpacksgroupproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpacksgroupproperties.go new file mode 100644 index 00000000000..4d6c242f3d0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildpacksgroupproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildpacksGroupProperties struct { + Buildpacks *[]BuildpackProperties `json:"buildpacks,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildproperties.go new file mode 100644 index 00000000000..f8edddb3e93 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildproperties.go @@ -0,0 +1,16 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildProperties struct { + AgentPool *string `json:"agentPool,omitempty"` + Apms *[]ApmReference `json:"apms,omitempty"` + Builder *string `json:"builder,omitempty"` + Certificates *[]CertificateReference `json:"certificates,omitempty"` + Env *map[string]string `json:"env,omitempty"` + ProvisioningState *BuildProvisioningState `json:"provisioningState,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + ResourceRequests *BuildResourceRequests `json:"resourceRequests,omitempty"` + TriggeredBuildResult *TriggeredBuildResult `json:"triggeredBuildResult,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresourcerequests.go new file mode 100644 index 00000000000..e86ba1c43c2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresourcerequests.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresult.go new file mode 100644 index 00000000000..a4c0a615789 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresult.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildResult struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BuildResultProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultlog.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultlog.go new file mode 100644 index 00000000000..904cc74807b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultlog.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildResultLog struct { + BlobURL *string `json:"blobUrl,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultproperties.go new file mode 100644 index 00000000000..8bfe1726410 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultproperties.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildResultProperties struct { + BuildPodName *string `json:"buildPodName,omitempty"` + BuildStages *[]BuildStageProperties `json:"buildStages,omitempty"` + Error *Error `json:"error,omitempty"` + Image *string `json:"image,omitempty"` + Name *string `json:"name,omitempty"` + ProvisioningState *BuildResultProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultusersourceinfo.go new file mode 100644 index 00000000000..c0221f1525b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildresultusersourceinfo.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ UserSourceInfo = BuildResultUserSourceInfo{} + +type BuildResultUserSourceInfo struct { + BuildResultId *string `json:"buildResultId,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s BuildResultUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = BuildResultUserSourceInfo{} + +func (s BuildResultUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper BuildResultUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling BuildResultUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling BuildResultUserSourceInfo: %+v", err) + } + + decoded["type"] = "BuildResult" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling BuildResultUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservice.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservice.go new file mode 100644 index 00000000000..3205837f88c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservice.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildService struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BuildServiceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolproperties.go new file mode 100644 index 00000000000..ae8dab0b539 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildServiceAgentPoolProperties struct { + PoolSize *BuildServiceAgentPoolSizeProperties `json:"poolSize,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolresource.go new file mode 100644 index 00000000000..fc05e8fc197 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildServiceAgentPoolResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BuildServiceAgentPoolProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolsizeproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolsizeproperties.go new file mode 100644 index 00000000000..b8e07c19039 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceagentpoolsizeproperties.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildServiceAgentPoolSizeProperties struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceproperties.go new file mode 100644 index 00000000000..d8f34b74578 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildserviceproperties.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildServiceProperties struct { + ContainerRegistry *string `json:"containerRegistry,omitempty"` + KPackVersion *string `json:"kPackVersion,omitempty"` + ProvisioningState *BuildServiceProvisioningState `json:"provisioningState,omitempty"` + ResourceRequests *BuildServicePropertiesResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservicepropertiesresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservicepropertiesresourcerequests.go new file mode 100644 index 00000000000..42baabe9e2f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildservicepropertiesresourcerequests.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildServicePropertiesResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildstageproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildstageproperties.go new file mode 100644 index 00000000000..3c21299fb45 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_buildstageproperties.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BuildStageProperties struct { + ExitCode *string `json:"exitCode,omitempty"` + Name *string `json:"name,omitempty"` + Reason *string `json:"reason,omitempty"` + Status *KPackBuildStageProvisioningState `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateproperties.go new file mode 100644 index 00000000000..538de405fe9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateproperties.go @@ -0,0 +1,91 @@ +package appplatform + +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 CertificateProperties interface { + CertificateProperties() BaseCertificatePropertiesImpl +} + +var _ CertificateProperties = BaseCertificatePropertiesImpl{} + +type BaseCertificatePropertiesImpl struct { + ActivateDate *string `json:"activateDate,omitempty"` + DnsNames *[]string `json:"dnsNames,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + IssuedDate *string `json:"issuedDate,omitempty"` + Issuer *string `json:"issuer,omitempty"` + ProvisioningState *CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Type string `json:"type"` +} + +func (s BaseCertificatePropertiesImpl) CertificateProperties() BaseCertificatePropertiesImpl { + return s +} + +var _ CertificateProperties = RawCertificatePropertiesImpl{} + +// RawCertificatePropertiesImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawCertificatePropertiesImpl struct { + certificateProperties BaseCertificatePropertiesImpl + Type string + Values map[string]interface{} +} + +func (s RawCertificatePropertiesImpl) CertificateProperties() BaseCertificatePropertiesImpl { + return s.certificateProperties +} + +func UnmarshalCertificatePropertiesImplementation(input []byte) (CertificateProperties, 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 CertificateProperties into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["type"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "ContentCertificate") { + var out ContentCertificateProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ContentCertificateProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "KeyVaultCertificate") { + var out KeyVaultCertificateProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KeyVaultCertificateProperties: %+v", err) + } + return out, nil + } + + var parent BaseCertificatePropertiesImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseCertificatePropertiesImpl: %+v", err) + } + + return RawCertificatePropertiesImpl{ + certificateProperties: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificatereference.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificatereference.go new file mode 100644 index 00000000000..5065589b920 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificatereference.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateReference struct { + ResourceId string `json:"resourceId"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateresource.go new file mode 100644 index 00000000000..3b9d36c6965 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_certificateresource.go @@ -0,0 +1,53 @@ +package appplatform + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties CertificateProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &CertificateResource{} + +func (s *CertificateResource) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Id = decoded.Id + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling CertificateResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := UnmarshalCertificatePropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'CertificateResource': %+v", err) + } + s.Properties = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_clusterresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_clusterresourceproperties.go new file mode 100644 index 00000000000..5949acd9866 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_clusterresourceproperties.go @@ -0,0 +1,72 @@ +package appplatform + +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. + +type ClusterResourceProperties struct { + Fqdn *string `json:"fqdn,omitempty"` + InfraResourceGroup *string `json:"infraResourceGroup,omitempty"` + MaintenanceScheduleConfiguration MaintenanceScheduleConfiguration `json:"maintenanceScheduleConfiguration"` + ManagedEnvironmentId *string `json:"managedEnvironmentId,omitempty"` + MarketplaceResource *MarketplaceResource `json:"marketplaceResource,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + PowerState *PowerState `json:"powerState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ServiceId *string `json:"serviceId,omitempty"` + Version *int64 `json:"version,omitempty"` + VnetAddons *ServiceVNetAddons `json:"vnetAddons,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +var _ json.Unmarshaler = &ClusterResourceProperties{} + +func (s *ClusterResourceProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Fqdn *string `json:"fqdn,omitempty"` + InfraResourceGroup *string `json:"infraResourceGroup,omitempty"` + ManagedEnvironmentId *string `json:"managedEnvironmentId,omitempty"` + MarketplaceResource *MarketplaceResource `json:"marketplaceResource,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + PowerState *PowerState `json:"powerState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ServiceId *string `json:"serviceId,omitempty"` + Version *int64 `json:"version,omitempty"` + VnetAddons *ServiceVNetAddons `json:"vnetAddons,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Fqdn = decoded.Fqdn + s.InfraResourceGroup = decoded.InfraResourceGroup + s.ManagedEnvironmentId = decoded.ManagedEnvironmentId + s.MarketplaceResource = decoded.MarketplaceResource + s.NetworkProfile = decoded.NetworkProfile + s.PowerState = decoded.PowerState + s.ProvisioningState = decoded.ProvisioningState + s.ServiceId = decoded.ServiceId + s.Version = decoded.Version + s.VnetAddons = decoded.VnetAddons + s.ZoneRedundant = decoded.ZoneRedundant + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ClusterResourceProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["maintenanceScheduleConfiguration"]; ok { + impl, err := UnmarshalMaintenanceScheduleConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'MaintenanceScheduleConfiguration' for 'ClusterResourceProperties': %+v", err) + } + s.MaintenanceScheduleConfiguration = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configservergitproperty.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configservergitproperty.go new file mode 100644 index 00000000000..0a5f30cc8d5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configservergitproperty.go @@ -0,0 +1,17 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerGitProperty struct { + HostKey *string `json:"hostKey,omitempty"` + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + Label *string `json:"label,omitempty"` + Password *string `json:"password,omitempty"` + PrivateKey *string `json:"privateKey,omitempty"` + Repositories *[]GitPatternRepository `json:"repositories,omitempty"` + SearchPaths *[]string `json:"searchPaths,omitempty"` + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` + Uri string `json:"uri"` + Username *string `json:"username,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverinstance.go new file mode 100644 index 00000000000..a41e3799c98 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverproperties.go new file mode 100644 index 00000000000..a929cc6717d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverproperties.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerProperties struct { + ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` + EnabledState *ConfigServerEnabledState `json:"enabledState,omitempty"` + Error *Error `json:"error,omitempty"` + Instances *[]ConfigServerInstance `json:"instances,omitempty"` + ProvisioningState *ConfigServerState `json:"provisioningState,omitempty"` + ResourceRequests *ConfigServerResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresource.go new file mode 100644 index 00000000000..c9d664e279e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigServerProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresourcerequests.go new file mode 100644 index 00000000000..1453d31cb2f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserverresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettings.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettings.go new file mode 100644 index 00000000000..ad971c3b34a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettings.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerSettings struct { + GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingserrorrecord.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingserrorrecord.go new file mode 100644 index 00000000000..69b1a5dc59a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingserrorrecord.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerSettingsErrorRecord struct { + Messages *[]string `json:"messages,omitempty"` + Name *string `json:"name,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingsvalidateresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingsvalidateresult.go new file mode 100644 index 00000000000..a7d1352c4a1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configserversettingsvalidateresult.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigServerSettingsValidateResult struct { + Details *[]ConfigServerSettingsErrorRecord `json:"details,omitempty"` + IsValid *bool `json:"isValid,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitproperty.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitproperty.go new file mode 100644 index 00000000000..8f78b230a5f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitproperty.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceGitProperty struct { + Repositories *[]ConfigurationServiceGitRepository `json:"repositories,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitpropertyvalidateresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitpropertyvalidateresult.go new file mode 100644 index 00000000000..fe5c13fee7c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitpropertyvalidateresult.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceGitPropertyValidateResult struct { + GitReposValidationResult *[]ValidationMessages `json:"gitReposValidationResult,omitempty"` + IsValid *bool `json:"isValid,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitrepository.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitrepository.go new file mode 100644 index 00000000000..38c61dd77f1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicegitrepository.go @@ -0,0 +1,20 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceGitRepository struct { + CaCertResourceId *string `json:"caCertResourceId,omitempty"` + GitImplementation *GitImplementation `json:"gitImplementation,omitempty"` + HostKey *string `json:"hostKey,omitempty"` + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + Label string `json:"label"` + Name string `json:"name"` + Password *string `json:"password,omitempty"` + Patterns []string `json:"patterns"` + PrivateKey *string `json:"privateKey,omitempty"` + SearchPaths *[]string `json:"searchPaths,omitempty"` + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` + Uri string `json:"uri"` + Username *string `json:"username,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceinstance.go new file mode 100644 index 00000000000..4542e6557cf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceproperties.go new file mode 100644 index 00000000000..da9b34f4445 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceproperties.go @@ -0,0 +1,12 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceProperties struct { + Generation *ConfigurationServiceGeneration `json:"generation,omitempty"` + Instances *[]ConfigurationServiceInstance `json:"instances,omitempty"` + ProvisioningState *ConfigurationServiceProvisioningState `json:"provisioningState,omitempty"` + ResourceRequests *ConfigurationServiceResourceRequests `json:"resourceRequests,omitempty"` + Settings *ConfigurationServiceSettings `json:"settings,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresource.go new file mode 100644 index 00000000000..c9c6ed459e9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationServiceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresourcerequests.go new file mode 100644 index 00000000000..087c114a134 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationserviceresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettings.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettings.go new file mode 100644 index 00000000000..fceb5dc412c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettings.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceSettings struct { + GitProperty *ConfigurationServiceGitProperty `json:"gitProperty,omitempty"` + RefreshIntervalInSeconds *int64 `json:"refreshIntervalInSeconds,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettingsvalidateresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettingsvalidateresult.go new file mode 100644 index 00000000000..075cbd23ea9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_configurationservicesettingsvalidateresult.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationServiceSettingsValidateResult struct { + GitPropertyValidationResult *ConfigurationServiceGitPropertyValidateResult `json:"gitPropertyValidationResult,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerprobesettings.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerprobesettings.go new file mode 100644 index 00000000000..b858f312a1a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerprobesettings.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProbeSettings struct { + DisableProbe *bool `json:"disableProbe,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrybasiccredentials.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrybasiccredentials.go new file mode 100644 index 00000000000..a5f9bcfb6a0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrybasiccredentials.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ ContainerRegistryCredentials = ContainerRegistryBasicCredentials{} + +type ContainerRegistryBasicCredentials struct { + Password string `json:"password"` + Server string `json:"server"` + Username string `json:"username"` + + // Fields inherited from ContainerRegistryCredentials + + Type string `json:"type"` +} + +func (s ContainerRegistryBasicCredentials) ContainerRegistryCredentials() BaseContainerRegistryCredentialsImpl { + return BaseContainerRegistryCredentialsImpl{ + Type: s.Type, + } +} + +var _ json.Marshaler = ContainerRegistryBasicCredentials{} + +func (s ContainerRegistryBasicCredentials) MarshalJSON() ([]byte, error) { + type wrapper ContainerRegistryBasicCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ContainerRegistryBasicCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ContainerRegistryBasicCredentials: %+v", err) + } + + decoded["type"] = "BasicAuth" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ContainerRegistryBasicCredentials: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrycredentials.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrycredentials.go new file mode 100644 index 00000000000..37b21f4fbbe --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistrycredentials.go @@ -0,0 +1,75 @@ +package appplatform + +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 ContainerRegistryCredentials interface { + ContainerRegistryCredentials() BaseContainerRegistryCredentialsImpl +} + +var _ ContainerRegistryCredentials = BaseContainerRegistryCredentialsImpl{} + +type BaseContainerRegistryCredentialsImpl struct { + Type string `json:"type"` +} + +func (s BaseContainerRegistryCredentialsImpl) ContainerRegistryCredentials() BaseContainerRegistryCredentialsImpl { + return s +} + +var _ ContainerRegistryCredentials = RawContainerRegistryCredentialsImpl{} + +// RawContainerRegistryCredentialsImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawContainerRegistryCredentialsImpl struct { + containerRegistryCredentials BaseContainerRegistryCredentialsImpl + Type string + Values map[string]interface{} +} + +func (s RawContainerRegistryCredentialsImpl) ContainerRegistryCredentials() BaseContainerRegistryCredentialsImpl { + return s.containerRegistryCredentials +} + +func UnmarshalContainerRegistryCredentialsImplementation(input []byte) (ContainerRegistryCredentials, 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 ContainerRegistryCredentials into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["type"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "BasicAuth") { + var out ContainerRegistryBasicCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ContainerRegistryBasicCredentials: %+v", err) + } + return out, nil + } + + var parent BaseContainerRegistryCredentialsImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseContainerRegistryCredentialsImpl: %+v", err) + } + + return RawContainerRegistryCredentialsImpl{ + containerRegistryCredentials: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryproperties.go new file mode 100644 index 00000000000..e93d3f3155d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryproperties.go @@ -0,0 +1,42 @@ +package appplatform + +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. + +type ContainerRegistryProperties struct { + Credentials ContainerRegistryCredentials `json:"credentials"` + ProvisioningState *ContainerRegistryProvisioningState `json:"provisioningState,omitempty"` +} + +var _ json.Unmarshaler = &ContainerRegistryProperties{} + +func (s *ContainerRegistryProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + ProvisioningState *ContainerRegistryProvisioningState `json:"provisioningState,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.ProvisioningState = decoded.ProvisioningState + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ContainerRegistryProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["credentials"]; ok { + impl, err := UnmarshalContainerRegistryCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Credentials' for 'ContainerRegistryProperties': %+v", err) + } + s.Credentials = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryresource.go new file mode 100644 index 00000000000..728b82001f9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerRegistryResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ContainerRegistryProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryvalidateresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryvalidateresult.go new file mode 100644 index 00000000000..566ef14c301 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_containerregistryvalidateresult.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerRegistryValidateResult struct { + IsValid *bool `json:"isValid,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_contentcertificateproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_contentcertificateproperties.go new file mode 100644 index 00000000000..f6fb41bdbcd --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_contentcertificateproperties.go @@ -0,0 +1,66 @@ +package appplatform + +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 _ CertificateProperties = ContentCertificateProperties{} + +type ContentCertificateProperties struct { + Content *string `json:"content,omitempty"` + + // Fields inherited from CertificateProperties + + ActivateDate *string `json:"activateDate,omitempty"` + DnsNames *[]string `json:"dnsNames,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + IssuedDate *string `json:"issuedDate,omitempty"` + Issuer *string `json:"issuer,omitempty"` + ProvisioningState *CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Type string `json:"type"` +} + +func (s ContentCertificateProperties) CertificateProperties() BaseCertificatePropertiesImpl { + return BaseCertificatePropertiesImpl{ + ActivateDate: s.ActivateDate, + DnsNames: s.DnsNames, + ExpirationDate: s.ExpirationDate, + IssuedDate: s.IssuedDate, + Issuer: s.Issuer, + ProvisioningState: s.ProvisioningState, + SubjectName: s.SubjectName, + Thumbprint: s.Thumbprint, + Type: s.Type, + } +} + +var _ json.Marshaler = ContentCertificateProperties{} + +func (s ContentCertificateProperties) MarshalJSON() ([]byte, error) { + type wrapper ContentCertificateProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ContentCertificateProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ContentCertificateProperties: %+v", err) + } + + decoded["type"] = "ContentCertificate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ContentCertificateProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainer.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainer.go new file mode 100644 index 00000000000..d67ee680ca1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainer.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomContainer struct { + Args *[]string `json:"args,omitempty"` + Command *[]string `json:"command,omitempty"` + ContainerImage *string `json:"containerImage,omitempty"` + ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` + LanguageFramework *string `json:"languageFramework,omitempty"` + Server *string `json:"server,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainerusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainerusersourceinfo.go new file mode 100644 index 00000000000..4140c24d62c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customcontainerusersourceinfo.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ UserSourceInfo = CustomContainerUserSourceInfo{} + +type CustomContainerUserSourceInfo struct { + CustomContainer *CustomContainer `json:"customContainer,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s CustomContainerUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = CustomContainerUserSourceInfo{} + +func (s CustomContainerUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper CustomContainerUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CustomContainerUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CustomContainerUserSourceInfo: %+v", err) + } + + decoded["type"] = "Container" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CustomContainerUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainproperties.go new file mode 100644 index 00000000000..fbe6f58fed4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainproperties.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainProperties struct { + AppName *string `json:"appName,omitempty"` + CertName *string `json:"certName,omitempty"` + ProvisioningState *CustomDomainResourceProvisioningState `json:"provisioningState,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainresource.go new file mode 100644 index 00000000000..c98396bfc64 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CustomDomainProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidatepayload.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidatepayload.go new file mode 100644 index 00000000000..3f88f30febf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidatepayload.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainValidatePayload struct { + Name string `json:"name"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidateresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidateresult.go new file mode 100644 index 00000000000..f0b328670af --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customdomainvalidateresult.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainValidateResult struct { + IsValid *bool `json:"isValid,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorproperties.go new file mode 100644 index 00000000000..0e5496603b4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorproperties.go @@ -0,0 +1,15 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomizedAcceleratorProperties struct { + AcceleratorTags *[]string `json:"acceleratorTags,omitempty"` + AcceleratorType *CustomizedAcceleratorType `json:"acceleratorType,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + GitRepository AcceleratorGitRepository `json:"gitRepository"` + IconURL *string `json:"iconUrl,omitempty"` + Imports *[]string `json:"imports,omitempty"` + ProvisioningState *CustomizedAcceleratorProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorresource.go new file mode 100644 index 00000000000..94e7f5059ea --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorresource.go @@ -0,0 +1,17 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomizedAcceleratorResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CustomizedAcceleratorProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorvalidateresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorvalidateresult.go new file mode 100644 index 00000000000..c50eabb29df --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customizedacceleratorvalidateresult.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomizedAcceleratorValidateResult struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + State *CustomizedAcceleratorValidateResultState `json:"state,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskproperties.go new file mode 100644 index 00000000000..fce77befdbc --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskproperties.go @@ -0,0 +1,79 @@ +package appplatform + +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 CustomPersistentDiskProperties interface { + CustomPersistentDiskProperties() BaseCustomPersistentDiskPropertiesImpl +} + +var _ CustomPersistentDiskProperties = BaseCustomPersistentDiskPropertiesImpl{} + +type BaseCustomPersistentDiskPropertiesImpl struct { + EnableSubPath *bool `json:"enableSubPath,omitempty"` + MountOptions *[]string `json:"mountOptions,omitempty"` + MountPath string `json:"mountPath"` + ReadOnly *bool `json:"readOnly,omitempty"` + Type Type `json:"type"` +} + +func (s BaseCustomPersistentDiskPropertiesImpl) CustomPersistentDiskProperties() BaseCustomPersistentDiskPropertiesImpl { + return s +} + +var _ CustomPersistentDiskProperties = RawCustomPersistentDiskPropertiesImpl{} + +// RawCustomPersistentDiskPropertiesImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawCustomPersistentDiskPropertiesImpl struct { + customPersistentDiskProperties BaseCustomPersistentDiskPropertiesImpl + Type string + Values map[string]interface{} +} + +func (s RawCustomPersistentDiskPropertiesImpl) CustomPersistentDiskProperties() BaseCustomPersistentDiskPropertiesImpl { + return s.customPersistentDiskProperties +} + +func UnmarshalCustomPersistentDiskPropertiesImplementation(input []byte) (CustomPersistentDiskProperties, 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 CustomPersistentDiskProperties into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["type"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "AzureFileVolume") { + var out AzureFileVolume + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureFileVolume: %+v", err) + } + return out, nil + } + + var parent BaseCustomPersistentDiskPropertiesImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseCustomPersistentDiskPropertiesImpl: %+v", err) + } + + return RawCustomPersistentDiskPropertiesImpl{ + customPersistentDiskProperties: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskresource.go new file mode 100644 index 00000000000..7dff858c779 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_custompersistentdiskresource.go @@ -0,0 +1,42 @@ +package appplatform + +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. + +type CustomPersistentDiskResource struct { + CustomPersistentDiskProperties CustomPersistentDiskProperties `json:"customPersistentDiskProperties"` + StorageId string `json:"storageId"` +} + +var _ json.Unmarshaler = &CustomPersistentDiskResource{} + +func (s *CustomPersistentDiskResource) UnmarshalJSON(bytes []byte) error { + var decoded struct { + StorageId string `json:"storageId"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.StorageId = decoded.StorageId + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling CustomPersistentDiskResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["customPersistentDiskProperties"]; ok { + impl, err := UnmarshalCustomPersistentDiskPropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'CustomPersistentDiskProperties' for 'CustomPersistentDiskResource': %+v", err) + } + s.CustomPersistentDiskProperties = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customscalerule.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customscalerule.go new file mode 100644 index 00000000000..2fca883c77c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_customscalerule.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentinstance.go new file mode 100644 index 00000000000..b58ef075e01 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentinstance.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentInstance struct { + DiscoveryStatus *string `json:"discoveryStatus,omitempty"` + Name *string `json:"name,omitempty"` + Reason *string `json:"reason,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *string `json:"status,omitempty"` + Zone *string `json:"zone,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentlist.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentlist.go new file mode 100644 index 00000000000..025ebeed99e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentlist.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentList struct { + Deployments *[]string `json:"deployments,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresource.go new file mode 100644 index 00000000000..08df95eb990 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresource.go @@ -0,0 +1,17 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DeploymentResourceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresourceproperties.go new file mode 100644 index 00000000000..115bdf6fdc9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentresourceproperties.go @@ -0,0 +1,54 @@ +package appplatform + +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. + +type DeploymentResourceProperties struct { + Active *bool `json:"active,omitempty"` + DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + Instances *[]DeploymentInstance `json:"instances,omitempty"` + ProvisioningState *DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` + Source UserSourceInfo `json:"source"` + Status *DeploymentResourceStatus `json:"status,omitempty"` +} + +var _ json.Unmarshaler = &DeploymentResourceProperties{} + +func (s *DeploymentResourceProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Active *bool `json:"active,omitempty"` + DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + Instances *[]DeploymentInstance `json:"instances,omitempty"` + ProvisioningState *DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` + Status *DeploymentResourceStatus `json:"status,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Active = decoded.Active + s.DeploymentSettings = decoded.DeploymentSettings + s.Instances = decoded.Instances + s.ProvisioningState = decoded.ProvisioningState + s.Status = decoded.Status + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DeploymentResourceProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["source"]; ok { + impl, err := UnmarshalUserSourceInfoImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Source' for 'DeploymentResourceProperties': %+v", err) + } + s.Source = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentsettings.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentsettings.go new file mode 100644 index 00000000000..d6306cd7a8b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_deploymentsettings.go @@ -0,0 +1,17 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentSettings struct { + AddonConfigs *map[string]interface{} `json:"addonConfigs,omitempty"` + Apms *[]ApmReference `json:"apms,omitempty"` + ContainerProbeSettings *ContainerProbeSettings `json:"containerProbeSettings,omitempty"` + EnvironmentVariables *map[string]string `json:"environmentVariables,omitempty"` + LivenessProbe *Probe `json:"livenessProbe,omitempty"` + ReadinessProbe *Probe `json:"readinessProbe,omitempty"` + ResourceRequests *ResourceRequests `json:"resourceRequests,omitempty"` + Scale *Scale `json:"scale,omitempty"` + StartupProbe *Probe `json:"startupProbe,omitempty"` + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalcomponent.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalcomponent.go new file mode 100644 index 00000000000..00e75136953 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalcomponent.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalComponent struct { + Instances *[]DevToolPortalInstance `json:"instances,omitempty"` + Name *string `json:"name,omitempty"` + ResourceRequests *DevToolPortalResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturedetail.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturedetail.go new file mode 100644 index 00000000000..ed071e9fe9e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturedetail.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalFeatureDetail struct { + Route *string `json:"route,omitempty"` + State *DevToolPortalFeatureState `json:"state,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturesettings.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturesettings.go new file mode 100644 index 00000000000..1ce0b56e745 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalfeaturesettings.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalFeatureSettings struct { + ApplicationAccelerator *DevToolPortalFeatureDetail `json:"applicationAccelerator,omitempty"` + ApplicationLiveView *DevToolPortalFeatureDetail `json:"applicationLiveView,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalinstance.go new file mode 100644 index 00000000000..4d118f5bc9e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalproperties.go new file mode 100644 index 00000000000..54af1b580cd --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalproperties.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalProperties struct { + Components *[]DevToolPortalComponent `json:"components,omitempty"` + Features *DevToolPortalFeatureSettings `json:"features,omitempty"` + ProvisioningState *DevToolPortalProvisioningState `json:"provisioningState,omitempty"` + Public *bool `json:"public,omitempty"` + SsoProperties *DevToolPortalSsoProperties `json:"ssoProperties,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresource.go new file mode 100644 index 00000000000..266723f0790 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DevToolPortalProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresourcerequests.go new file mode 100644 index 00000000000..acf05c68466 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalssoproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalssoproperties.go new file mode 100644 index 00000000000..5e96437497c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_devtoolportalssoproperties.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevToolPortalSsoProperties struct { + ClientId *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + MetadataURL *string `json:"metadataUrl,omitempty"` + Scopes *[]string `json:"scopes,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_diagnosticparameters.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_diagnosticparameters.go new file mode 100644 index 00000000000..56c21150593 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_diagnosticparameters.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticParameters struct { + AppInstance *string `json:"appInstance,omitempty"` + Duration *string `json:"duration,omitempty"` + FilePath *string `json:"filePath,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_envsecretscollection.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_envsecretscollection.go new file mode 100644 index 00000000000..22fd6684926 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_envsecretscollection.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvSecretsCollection struct { + Value []Secret `json:"value"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_envvar.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_envvar.go new file mode 100644 index 00000000000..784b4fffd18 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_envvar.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvVar struct { + Name *string `json:"name,omitempty"` + SecretValue *string `json:"secretValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_error.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_error.go new file mode 100644 index 00000000000..2771d372749 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_error.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverproperties.go new file mode 100644 index 00000000000..9e377f92438 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverproperties.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EurekaServerProperties struct { + EnabledState *EurekaServerEnabledState `json:"enabledState,omitempty"` + Error *Error `json:"error,omitempty"` + ProvisioningState *EurekaServerState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverresource.go new file mode 100644 index 00000000000..73eb7b1b697 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_eurekaserverresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EurekaServerResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EurekaServerProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_execaction.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_execaction.go new file mode 100644 index 00000000000..45312ffa5da --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_execaction.go @@ -0,0 +1,50 @@ +package appplatform + +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 _ ProbeAction = ExecAction{} + +type ExecAction struct { + Command *[]string `json:"command,omitempty"` + + // Fields inherited from ProbeAction + + Type ProbeActionType `json:"type"` +} + +func (s ExecAction) ProbeAction() BaseProbeActionImpl { + return BaseProbeActionImpl{ + Type: s.Type, + } +} + +var _ json.Marshaler = ExecAction{} + +func (s ExecAction) MarshalJSON() ([]byte, error) { + type wrapper ExecAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ExecAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ExecAction: %+v", err) + } + + decoded["type"] = "ExecAction" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ExecAction: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapimetadataproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapimetadataproperties.go new file mode 100644 index 00000000000..dff39d628ee --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapimetadataproperties.go @@ -0,0 +1,12 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayApiMetadataProperties struct { + Description *string `json:"description,omitempty"` + Documentation *string `json:"documentation,omitempty"` + ServerURL *string `json:"serverUrl,omitempty"` + Title *string `json:"title,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapiroute.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapiroute.go new file mode 100644 index 00000000000..eafc486c45f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayapiroute.go @@ -0,0 +1,16 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayApiRoute struct { + Description *string `json:"description,omitempty"` + Filters *[]string `json:"filters,omitempty"` + Order *int64 `json:"order,omitempty"` + Predicates *[]string `json:"predicates,omitempty"` + SsoEnabled *bool `json:"ssoEnabled,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Title *string `json:"title,omitempty"` + TokenRelay *bool `json:"tokenRelay,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycorsproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycorsproperties.go new file mode 100644 index 00000000000..181b9b32de4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycorsproperties.go @@ -0,0 +1,14 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCorsProperties struct { + AllowCredentials *bool `json:"allowCredentials,omitempty"` + AllowedHeaders *[]string `json:"allowedHeaders,omitempty"` + AllowedMethods *[]string `json:"allowedMethods,omitempty"` + AllowedOriginPatterns *[]string `json:"allowedOriginPatterns,omitempty"` + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` + ExposedHeaders *[]string `json:"exposedHeaders,omitempty"` + MaxAge *int64 `json:"maxAge,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainproperties.go new file mode 100644 index 00000000000..49b3b1e778e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainproperties.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCustomDomainProperties struct { + Thumbprint *string `json:"thumbprint,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainresource.go new file mode 100644 index 00000000000..1adab8f5fbf --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaycustomdomainresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayCustomDomainResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GatewayCustomDomainProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayinstance.go new file mode 100644 index 00000000000..0c3c2e33405 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperinstanceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperinstanceproperties.go new file mode 100644 index 00000000000..9b03b60fb1b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperinstanceproperties.go @@ -0,0 +1,51 @@ +package appplatform + +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 _ GatewayResponseCacheProperties = GatewayLocalResponseCachePerInstanceProperties{} + +type GatewayLocalResponseCachePerInstanceProperties struct { + Size *string `json:"size,omitempty"` + TimeToLive *string `json:"timeToLive,omitempty"` + + // Fields inherited from GatewayResponseCacheProperties + + ResponseCacheType string `json:"responseCacheType"` +} + +func (s GatewayLocalResponseCachePerInstanceProperties) GatewayResponseCacheProperties() BaseGatewayResponseCachePropertiesImpl { + return BaseGatewayResponseCachePropertiesImpl{ + ResponseCacheType: s.ResponseCacheType, + } +} + +var _ json.Marshaler = GatewayLocalResponseCachePerInstanceProperties{} + +func (s GatewayLocalResponseCachePerInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper GatewayLocalResponseCachePerInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling GatewayLocalResponseCachePerInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling GatewayLocalResponseCachePerInstanceProperties: %+v", err) + } + + decoded["responseCacheType"] = "LocalCachePerInstance" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling GatewayLocalResponseCachePerInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperrouteproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperrouteproperties.go new file mode 100644 index 00000000000..02a1e952dc1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaylocalresponsecacheperrouteproperties.go @@ -0,0 +1,51 @@ +package appplatform + +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 _ GatewayResponseCacheProperties = GatewayLocalResponseCachePerRouteProperties{} + +type GatewayLocalResponseCachePerRouteProperties struct { + Size *string `json:"size,omitempty"` + TimeToLive *string `json:"timeToLive,omitempty"` + + // Fields inherited from GatewayResponseCacheProperties + + ResponseCacheType string `json:"responseCacheType"` +} + +func (s GatewayLocalResponseCachePerRouteProperties) GatewayResponseCacheProperties() BaseGatewayResponseCachePropertiesImpl { + return BaseGatewayResponseCachePropertiesImpl{ + ResponseCacheType: s.ResponseCacheType, + } +} + +var _ json.Marshaler = GatewayLocalResponseCachePerRouteProperties{} + +func (s GatewayLocalResponseCachePerRouteProperties) MarshalJSON() ([]byte, error) { + type wrapper GatewayLocalResponseCachePerRouteProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling GatewayLocalResponseCachePerRouteProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling GatewayLocalResponseCachePerRouteProperties: %+v", err) + } + + decoded["responseCacheType"] = "LocalCachePerRoute" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling GatewayLocalResponseCachePerRouteProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorproperties.go new file mode 100644 index 00000000000..ca404d33b4e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayOperatorProperties struct { + Instances *[]GatewayInstance `json:"instances,omitempty"` + ResourceRequests *GatewayOperatorResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorresourcerequests.go new file mode 100644 index 00000000000..582890dfe32 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayoperatorresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayOperatorResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayproperties.go new file mode 100644 index 00000000000..029aa2ecbf2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayproperties.go @@ -0,0 +1,84 @@ +package appplatform + +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. + +type GatewayProperties struct { + AddonConfigs *map[string]interface{} `json:"addonConfigs,omitempty"` + ApiMetadataProperties *GatewayApiMetadataProperties `json:"apiMetadataProperties,omitempty"` + ApmTypes *[]ApmType `json:"apmTypes,omitempty"` + Apms *[]ApmReference `json:"apms,omitempty"` + ClientAuth *GatewayPropertiesClientAuth `json:"clientAuth,omitempty"` + CorsProperties *GatewayCorsProperties `json:"corsProperties,omitempty"` + EnvironmentVariables *GatewayPropertiesEnvironmentVariables `json:"environmentVariables,omitempty"` + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + Instances *[]GatewayInstance `json:"instances,omitempty"` + OperatorProperties *GatewayOperatorProperties `json:"operatorProperties,omitempty"` + ProvisioningState *GatewayProvisioningState `json:"provisioningState,omitempty"` + Public *bool `json:"public,omitempty"` + ResourceRequests *GatewayResourceRequests `json:"resourceRequests,omitempty"` + ResponseCacheProperties GatewayResponseCacheProperties `json:"responseCacheProperties"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + Url *string `json:"url,omitempty"` +} + +var _ json.Unmarshaler = &GatewayProperties{} + +func (s *GatewayProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + AddonConfigs *map[string]interface{} `json:"addonConfigs,omitempty"` + ApiMetadataProperties *GatewayApiMetadataProperties `json:"apiMetadataProperties,omitempty"` + ApmTypes *[]ApmType `json:"apmTypes,omitempty"` + Apms *[]ApmReference `json:"apms,omitempty"` + ClientAuth *GatewayPropertiesClientAuth `json:"clientAuth,omitempty"` + CorsProperties *GatewayCorsProperties `json:"corsProperties,omitempty"` + EnvironmentVariables *GatewayPropertiesEnvironmentVariables `json:"environmentVariables,omitempty"` + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + Instances *[]GatewayInstance `json:"instances,omitempty"` + OperatorProperties *GatewayOperatorProperties `json:"operatorProperties,omitempty"` + ProvisioningState *GatewayProvisioningState `json:"provisioningState,omitempty"` + Public *bool `json:"public,omitempty"` + ResourceRequests *GatewayResourceRequests `json:"resourceRequests,omitempty"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + Url *string `json:"url,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.AddonConfigs = decoded.AddonConfigs + s.ApiMetadataProperties = decoded.ApiMetadataProperties + s.ApmTypes = decoded.ApmTypes + s.Apms = decoded.Apms + s.ClientAuth = decoded.ClientAuth + s.CorsProperties = decoded.CorsProperties + s.EnvironmentVariables = decoded.EnvironmentVariables + s.HTTPSOnly = decoded.HTTPSOnly + s.Instances = decoded.Instances + s.OperatorProperties = decoded.OperatorProperties + s.ProvisioningState = decoded.ProvisioningState + s.Public = decoded.Public + s.ResourceRequests = decoded.ResourceRequests + s.SsoProperties = decoded.SsoProperties + s.Url = decoded.Url + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling GatewayProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["responseCacheProperties"]; ok { + impl, err := UnmarshalGatewayResponseCachePropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'ResponseCacheProperties' for 'GatewayProperties': %+v", err) + } + s.ResponseCacheProperties = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesclientauth.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesclientauth.go new file mode 100644 index 00000000000..019b1f29215 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesclientauth.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayPropertiesClientAuth struct { + CertificateVerification *GatewayCertificateVerification `json:"certificateVerification,omitempty"` + Certificates *[]string `json:"certificates,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesenvironmentvariables.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesenvironmentvariables.go new file mode 100644 index 00000000000..19370e884cb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewaypropertiesenvironmentvariables.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayPropertiesEnvironmentVariables struct { + Properties *map[string]string `json:"properties,omitempty"` + Secrets *map[string]string `json:"secrets,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresource.go new file mode 100644 index 00000000000..80caf5d2e02 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresource.go @@ -0,0 +1,17 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GatewayProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresourcerequests.go new file mode 100644 index 00000000000..908bc1bdea6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresourcerequests.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresponsecacheproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresponsecacheproperties.go new file mode 100644 index 00000000000..32b4c428f53 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayresponsecacheproperties.go @@ -0,0 +1,83 @@ +package appplatform + +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 GatewayResponseCacheProperties interface { + GatewayResponseCacheProperties() BaseGatewayResponseCachePropertiesImpl +} + +var _ GatewayResponseCacheProperties = BaseGatewayResponseCachePropertiesImpl{} + +type BaseGatewayResponseCachePropertiesImpl struct { + ResponseCacheType string `json:"responseCacheType"` +} + +func (s BaseGatewayResponseCachePropertiesImpl) GatewayResponseCacheProperties() BaseGatewayResponseCachePropertiesImpl { + return s +} + +var _ GatewayResponseCacheProperties = RawGatewayResponseCachePropertiesImpl{} + +// RawGatewayResponseCachePropertiesImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawGatewayResponseCachePropertiesImpl struct { + gatewayResponseCacheProperties BaseGatewayResponseCachePropertiesImpl + Type string + Values map[string]interface{} +} + +func (s RawGatewayResponseCachePropertiesImpl) GatewayResponseCacheProperties() BaseGatewayResponseCachePropertiesImpl { + return s.gatewayResponseCacheProperties +} + +func UnmarshalGatewayResponseCachePropertiesImplementation(input []byte) (GatewayResponseCacheProperties, 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 GatewayResponseCacheProperties into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["responseCacheType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "LocalCachePerInstance") { + var out GatewayLocalResponseCachePerInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into GatewayLocalResponseCachePerInstanceProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "LocalCachePerRoute") { + var out GatewayLocalResponseCachePerRouteProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into GatewayLocalResponseCachePerRouteProperties: %+v", err) + } + return out, nil + } + + var parent BaseGatewayResponseCachePropertiesImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseGatewayResponseCachePropertiesImpl: %+v", err) + } + + return RawGatewayResponseCachePropertiesImpl{ + gatewayResponseCacheProperties: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigopenapiproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigopenapiproperties.go new file mode 100644 index 00000000000..6eeda31eddb --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigopenapiproperties.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayRouteConfigOpenApiProperties struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigproperties.go new file mode 100644 index 00000000000..e77414d826b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigproperties.go @@ -0,0 +1,15 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayRouteConfigProperties struct { + AppResourceId *string `json:"appResourceId,omitempty"` + Filters *[]string `json:"filters,omitempty"` + OpenApi *GatewayRouteConfigOpenApiProperties `json:"openApi,omitempty"` + Predicates *[]string `json:"predicates,omitempty"` + Protocol *GatewayRouteConfigProtocol `json:"protocol,omitempty"` + ProvisioningState *GatewayProvisioningState `json:"provisioningState,omitempty"` + Routes *[]GatewayApiRoute `json:"routes,omitempty"` + SsoEnabled *bool `json:"ssoEnabled,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigresource.go new file mode 100644 index 00000000000..927ad10c249 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gatewayrouteconfigresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayRouteConfigResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GatewayRouteConfigProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gitpatternrepository.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gitpatternrepository.go new file mode 100644 index 00000000000..130e4b73b80 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_gitpatternrepository.go @@ -0,0 +1,18 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GitPatternRepository struct { + HostKey *string `json:"hostKey,omitempty"` + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + Label *string `json:"label,omitempty"` + Name string `json:"name"` + Password *string `json:"password,omitempty"` + Pattern *[]string `json:"pattern,omitempty"` + PrivateKey *string `json:"privateKey,omitempty"` + SearchPaths *[]string `json:"searchPaths,omitempty"` + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` + Uri string `json:"uri"` + Username *string `json:"username,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_globallyenabledapms.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_globallyenabledapms.go new file mode 100644 index 00000000000..e86c1ddc1a1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_globallyenabledapms.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GloballyEnabledApms struct { + Value *[]string `json:"value,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpgetaction.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpgetaction.go new file mode 100644 index 00000000000..becd9aadb38 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpgetaction.go @@ -0,0 +1,51 @@ +package appplatform + +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 _ ProbeAction = HTTPGetAction{} + +type HTTPGetAction struct { + Path *string `json:"path,omitempty"` + Scheme *HTTPSchemeType `json:"scheme,omitempty"` + + // Fields inherited from ProbeAction + + Type ProbeActionType `json:"type"` +} + +func (s HTTPGetAction) ProbeAction() BaseProbeActionImpl { + return BaseProbeActionImpl{ + Type: s.Type, + } +} + +var _ json.Marshaler = HTTPGetAction{} + +func (s HTTPGetAction) MarshalJSON() ([]byte, error) { + type wrapper HTTPGetAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling HTTPGetAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling HTTPGetAction: %+v", err) + } + + decoded["type"] = "HTTPGetAction" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling HTTPGetAction: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpscalerule.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpscalerule.go new file mode 100644 index 00000000000..e0a300a53d3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_httpscalerule.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_imageregistrycredential.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_imageregistrycredential.go new file mode 100644 index 00000000000..94706ca594e --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_imageregistrycredential.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageRegistryCredential struct { + Password *string `json:"password,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingressconfig.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingressconfig.go new file mode 100644 index 00000000000..d258752f4e8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingressconfig.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IngressConfig struct { + ReadTimeoutInSeconds *int64 `json:"readTimeoutInSeconds,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettings.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettings.go new file mode 100644 index 00000000000..5292d5d8fac --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettings.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IngressSettings struct { + BackendProtocol *BackendProtocol `json:"backendProtocol,omitempty"` + ClientAuth *IngressSettingsClientAuth `json:"clientAuth,omitempty"` + ReadTimeoutInSeconds *int64 `json:"readTimeoutInSeconds,omitempty"` + SendTimeoutInSeconds *int64 `json:"sendTimeoutInSeconds,omitempty"` + SessionAffinity *SessionAffinity `json:"sessionAffinity,omitempty"` + SessionCookieMaxAge *int64 `json:"sessionCookieMaxAge,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettingsclientauth.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettingsclientauth.go new file mode 100644 index 00000000000..2c5720c5dd6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ingresssettingsclientauth.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IngressSettingsClientAuth struct { + Certificates *[]string `json:"certificates,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jaruploadedusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jaruploadedusersourceinfo.go new file mode 100644 index 00000000000..8b8eb662790 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jaruploadedusersourceinfo.go @@ -0,0 +1,54 @@ +package appplatform + +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 _ UserSourceInfo = JarUploadedUserSourceInfo{} + +type JarUploadedUserSourceInfo struct { + JVMOptions *string `json:"jvmOptions,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s JarUploadedUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = JarUploadedUserSourceInfo{} + +func (s JarUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper JarUploadedUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling JarUploadedUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling JarUploadedUserSourceInfo: %+v", err) + } + + decoded["type"] = "Jar" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling JarUploadedUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecution.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecution.go new file mode 100644 index 00000000000..51400354283 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecution.go @@ -0,0 +1,43 @@ +package appplatform + +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 JobExecution struct { + EndTime *string `json:"endTime,omitempty"` + JobSnapshot *JobResourceProperties `json:"jobSnapshot,omitempty"` + Name *string `json:"name,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *JobExecutionRunningState `json:"status,omitempty"` + Template *JobExecutionTemplate `json:"template,omitempty"` +} + +func (o *JobExecution) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *JobExecution) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *JobExecution) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *JobExecution) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecutiontemplate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecutiontemplate.go new file mode 100644 index 00000000000..52709708e69 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobexecutiontemplate.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobExecutionTemplate struct { + Args *[]string `json:"args,omitempty"` + EnvironmentVariables *[]EnvVar `json:"environmentVariables,omitempty"` + ResourceRequests *JobResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresource.go new file mode 100644 index 00000000000..44c8e2e62f8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *JobResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourceproperties.go new file mode 100644 index 00000000000..8dd9f422ebd --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourceproperties.go @@ -0,0 +1,57 @@ +package appplatform + +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. + +type JobResourceProperties struct { + ManagedComponentReferences *[]ManagedComponentReference `json:"managedComponentReferences,omitempty"` + ProvisioningState *JobResourceProvisioningState `json:"provisioningState,omitempty"` + Source UserSourceInfo `json:"source"` + Template *JobExecutionTemplate `json:"template,omitempty"` + TriggerConfig JobTriggerConfig `json:"triggerConfig"` +} + +var _ json.Unmarshaler = &JobResourceProperties{} + +func (s *JobResourceProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + ManagedComponentReferences *[]ManagedComponentReference `json:"managedComponentReferences,omitempty"` + ProvisioningState *JobResourceProvisioningState `json:"provisioningState,omitempty"` + Template *JobExecutionTemplate `json:"template,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.ManagedComponentReferences = decoded.ManagedComponentReferences + s.ProvisioningState = decoded.ProvisioningState + s.Template = decoded.Template + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling JobResourceProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["source"]; ok { + impl, err := UnmarshalUserSourceInfoImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Source' for 'JobResourceProperties': %+v", err) + } + s.Source = impl + } + + if v, ok := temp["triggerConfig"]; ok { + impl, err := UnmarshalJobTriggerConfigImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'TriggerConfig' for 'JobResourceProperties': %+v", err) + } + s.TriggerConfig = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourcerequests.go new file mode 100644 index 00000000000..46d78b67b97 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobresourcerequests.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobtriggerconfig.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobtriggerconfig.go new file mode 100644 index 00000000000..e1918ee379b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_jobtriggerconfig.go @@ -0,0 +1,75 @@ +package appplatform + +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 JobTriggerConfig interface { + JobTriggerConfig() BaseJobTriggerConfigImpl +} + +var _ JobTriggerConfig = BaseJobTriggerConfigImpl{} + +type BaseJobTriggerConfigImpl struct { + TriggerType TriggerType `json:"triggerType"` +} + +func (s BaseJobTriggerConfigImpl) JobTriggerConfig() BaseJobTriggerConfigImpl { + return s +} + +var _ JobTriggerConfig = RawJobTriggerConfigImpl{} + +// RawJobTriggerConfigImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawJobTriggerConfigImpl struct { + jobTriggerConfig BaseJobTriggerConfigImpl + Type string + Values map[string]interface{} +} + +func (s RawJobTriggerConfigImpl) JobTriggerConfig() BaseJobTriggerConfigImpl { + return s.jobTriggerConfig +} + +func UnmarshalJobTriggerConfigImplementation(input []byte) (JobTriggerConfig, 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 JobTriggerConfig into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["triggerType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "Manual") { + var out ManualJobTriggerConfig + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ManualJobTriggerConfig: %+v", err) + } + return out, nil + } + + var parent BaseJobTriggerConfigImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseJobTriggerConfigImpl: %+v", err) + } + + return RawJobTriggerConfigImpl{ + jobTriggerConfig: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_keyvaultcertificateproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_keyvaultcertificateproperties.go new file mode 100644 index 00000000000..22d986dece6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_keyvaultcertificateproperties.go @@ -0,0 +1,70 @@ +package appplatform + +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 _ CertificateProperties = KeyVaultCertificateProperties{} + +type KeyVaultCertificateProperties struct { + AutoSync *KeyVaultCertificateAutoSync `json:"autoSync,omitempty"` + CertVersion *string `json:"certVersion,omitempty"` + ExcludePrivateKey *bool `json:"excludePrivateKey,omitempty"` + KeyVaultCertName string `json:"keyVaultCertName"` + VaultUri string `json:"vaultUri"` + + // Fields inherited from CertificateProperties + + ActivateDate *string `json:"activateDate,omitempty"` + DnsNames *[]string `json:"dnsNames,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + IssuedDate *string `json:"issuedDate,omitempty"` + Issuer *string `json:"issuer,omitempty"` + ProvisioningState *CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Type string `json:"type"` +} + +func (s KeyVaultCertificateProperties) CertificateProperties() BaseCertificatePropertiesImpl { + return BaseCertificatePropertiesImpl{ + ActivateDate: s.ActivateDate, + DnsNames: s.DnsNames, + ExpirationDate: s.ExpirationDate, + IssuedDate: s.IssuedDate, + Issuer: s.Issuer, + ProvisioningState: s.ProvisioningState, + SubjectName: s.SubjectName, + Thumbprint: s.Thumbprint, + Type: s.Type, + } +} + +var _ json.Marshaler = KeyVaultCertificateProperties{} + +func (s KeyVaultCertificateProperties) MarshalJSON() ([]byte, error) { + type wrapper KeyVaultCertificateProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KeyVaultCertificateProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KeyVaultCertificateProperties: %+v", err) + } + + decoded["type"] = "KeyVaultCertificate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KeyVaultCertificateProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_loadedcertificate.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_loadedcertificate.go new file mode 100644 index 00000000000..92408a0cad4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_loadedcertificate.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadedCertificate struct { + LoadTrustStore *bool `json:"loadTrustStore,omitempty"` + ResourceId string `json:"resourceId"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_logfileurlresponse.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_logfileurlresponse.go new file mode 100644 index 00000000000..6a970d33610 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_logfileurlresponse.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogFileURLResponse struct { + Url string `json:"url"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_maintenancescheduleconfiguration.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_maintenancescheduleconfiguration.go new file mode 100644 index 00000000000..e412c94e8b0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_maintenancescheduleconfiguration.go @@ -0,0 +1,75 @@ +package appplatform + +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 MaintenanceScheduleConfiguration interface { + MaintenanceScheduleConfiguration() BaseMaintenanceScheduleConfigurationImpl +} + +var _ MaintenanceScheduleConfiguration = BaseMaintenanceScheduleConfigurationImpl{} + +type BaseMaintenanceScheduleConfigurationImpl struct { + Frequency Frequency `json:"frequency"` +} + +func (s BaseMaintenanceScheduleConfigurationImpl) MaintenanceScheduleConfiguration() BaseMaintenanceScheduleConfigurationImpl { + return s +} + +var _ MaintenanceScheduleConfiguration = RawMaintenanceScheduleConfigurationImpl{} + +// RawMaintenanceScheduleConfigurationImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawMaintenanceScheduleConfigurationImpl struct { + maintenanceScheduleConfiguration BaseMaintenanceScheduleConfigurationImpl + Type string + Values map[string]interface{} +} + +func (s RawMaintenanceScheduleConfigurationImpl) MaintenanceScheduleConfiguration() BaseMaintenanceScheduleConfigurationImpl { + return s.maintenanceScheduleConfiguration +} + +func UnmarshalMaintenanceScheduleConfigurationImplementation(input []byte) (MaintenanceScheduleConfiguration, 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 MaintenanceScheduleConfiguration into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["frequency"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "Weekly") { + var out WeeklyMaintenanceScheduleConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into WeeklyMaintenanceScheduleConfiguration: %+v", err) + } + return out, nil + } + + var parent BaseMaintenanceScheduleConfigurationImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseMaintenanceScheduleConfigurationImpl: %+v", err) + } + + return RawMaintenanceScheduleConfigurationImpl{ + maintenanceScheduleConfiguration: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_managedcomponentreference.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_managedcomponentreference.go new file mode 100644 index 00000000000..5ca5cf2d1cc --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_managedcomponentreference.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedComponentReference struct { + ResourceId string `json:"resourceId"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_manualjobtriggerconfig.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_manualjobtriggerconfig.go new file mode 100644 index 00000000000..a035486f516 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_manualjobtriggerconfig.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ JobTriggerConfig = ManualJobTriggerConfig{} + +type ManualJobTriggerConfig struct { + Parallelism *int64 `json:"parallelism,omitempty"` + RetryLimit *int64 `json:"retryLimit,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + + // Fields inherited from JobTriggerConfig + + TriggerType TriggerType `json:"triggerType"` +} + +func (s ManualJobTriggerConfig) JobTriggerConfig() BaseJobTriggerConfigImpl { + return BaseJobTriggerConfigImpl{ + TriggerType: s.TriggerType, + } +} + +var _ json.Marshaler = ManualJobTriggerConfig{} + +func (s ManualJobTriggerConfig) MarshalJSON() ([]byte, error) { + type wrapper ManualJobTriggerConfig + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ManualJobTriggerConfig: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ManualJobTriggerConfig: %+v", err) + } + + decoded["triggerType"] = "Manual" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ManualJobTriggerConfig: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_marketplaceresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_marketplaceresource.go new file mode 100644 index 00000000000..4f27db37897 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_marketplaceresource.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MarketplaceResource struct { + Plan *string `json:"plan,omitempty"` + Product *string `json:"product,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingproperties.go new file mode 100644 index 00000000000..57067eaae23 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingproperties.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettingProperties struct { + AppInsightsAgentVersions *ApplicationInsightsAgentVersions `json:"appInsightsAgentVersions,omitempty"` + AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` + AppInsightsSamplingRate *float64 `json:"appInsightsSamplingRate,omitempty"` + Error *Error `json:"error,omitempty"` + ProvisioningState *MonitoringSettingState `json:"provisioningState,omitempty"` + TraceEnabled *bool `json:"traceEnabled,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingresource.go new file mode 100644 index 00000000000..4dc0f0ef4e0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_monitoringsettingresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettingResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *MonitoringSettingProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailability.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailability.go new file mode 100644 index 00000000000..e3b93e3ffbe --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailability.go @@ -0,0 +1,10 @@ +package appplatform + +// 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/resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailabilityparameters.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailabilityparameters.go new file mode 100644 index 00000000000..a831cfda0e6 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_nameavailabilityparameters.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailabilityParameters struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_netcorezipuploadedusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_netcorezipuploadedusersourceinfo.go new file mode 100644 index 00000000000..7c52088222a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_netcorezipuploadedusersourceinfo.go @@ -0,0 +1,54 @@ +package appplatform + +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 _ UserSourceInfo = NetCoreZipUploadedUserSourceInfo{} + +type NetCoreZipUploadedUserSourceInfo struct { + NetCoreMainEntryPath *string `json:"netCoreMainEntryPath,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s NetCoreZipUploadedUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = NetCoreZipUploadedUserSourceInfo{} + +func (s NetCoreZipUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper NetCoreZipUploadedUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling NetCoreZipUploadedUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling NetCoreZipUploadedUserSourceInfo: %+v", err) + } + + decoded["type"] = "NetCoreZip" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling NetCoreZipUploadedUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofile.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofile.go new file mode 100644 index 00000000000..24ac5049313 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofile.go @@ -0,0 +1,16 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` + AppSubnetId *string `json:"appSubnetId,omitempty"` + IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` + OutboundIPs *NetworkProfileOutboundIPs `json:"outboundIPs,omitempty"` + OutboundType *string `json:"outboundType,omitempty"` + RequiredTraffics *[]RequiredTraffic `json:"requiredTraffics,omitempty"` + ServiceCidr *string `json:"serviceCidr,omitempty"` + ServiceRuntimeNetworkResourceGroup *string `json:"serviceRuntimeNetworkResourceGroup,omitempty"` + ServiceRuntimeSubnetId *string `json:"serviceRuntimeSubnetId,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofileoutboundips.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofileoutboundips.go new file mode 100644 index 00000000000..c5fc3ebbae4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_networkprofileoutboundips.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfileOutboundIPs struct { + PublicIPs *[]string `json:"publicIPs,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_persistentdisk.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_persistentdisk.go new file mode 100644 index 00000000000..2478dd8579d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_persistentdisk.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PersistentDisk struct { + MountPath *string `json:"mountPath,omitempty"` + SizeInGB *int64 `json:"sizeInGB,omitempty"` + UsedInGB *int64 `json:"usedInGB,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorproperties.go new file mode 100644 index 00000000000..6891240fe47 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorproperties.go @@ -0,0 +1,13 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PredefinedAcceleratorProperties struct { + AcceleratorTags *[]string `json:"acceleratorTags,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IconURL *string `json:"iconUrl,omitempty"` + ProvisioningState *PredefinedAcceleratorProvisioningState `json:"provisioningState,omitempty"` + State *PredefinedAcceleratorState `json:"state,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorresource.go new file mode 100644 index 00000000000..ec9c1d50e44 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_predefinedacceleratorresource.go @@ -0,0 +1,17 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PredefinedAcceleratorResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PredefinedAcceleratorProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_probe.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_probe.go new file mode 100644 index 00000000000..d21b9afd46c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_probe.go @@ -0,0 +1,57 @@ +package appplatform + +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. + +type Probe struct { + DisableProbe bool `json:"disableProbe"` + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + ProbeAction ProbeAction `json:"probeAction"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` +} + +var _ json.Unmarshaler = &Probe{} + +func (s *Probe) UnmarshalJSON(bytes []byte) error { + var decoded struct { + DisableProbe bool `json:"disableProbe"` + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.DisableProbe = decoded.DisableProbe + s.FailureThreshold = decoded.FailureThreshold + s.InitialDelaySeconds = decoded.InitialDelaySeconds + s.PeriodSeconds = decoded.PeriodSeconds + s.SuccessThreshold = decoded.SuccessThreshold + s.TimeoutSeconds = decoded.TimeoutSeconds + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling Probe into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["probeAction"]; ok { + impl, err := UnmarshalProbeActionImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'ProbeAction' for 'Probe': %+v", err) + } + s.ProbeAction = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_probeaction.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_probeaction.go new file mode 100644 index 00000000000..8dd98c9d225 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_probeaction.go @@ -0,0 +1,91 @@ +package appplatform + +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 ProbeAction interface { + ProbeAction() BaseProbeActionImpl +} + +var _ ProbeAction = BaseProbeActionImpl{} + +type BaseProbeActionImpl struct { + Type ProbeActionType `json:"type"` +} + +func (s BaseProbeActionImpl) ProbeAction() BaseProbeActionImpl { + return s +} + +var _ ProbeAction = RawProbeActionImpl{} + +// RawProbeActionImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawProbeActionImpl struct { + probeAction BaseProbeActionImpl + Type string + Values map[string]interface{} +} + +func (s RawProbeActionImpl) ProbeAction() BaseProbeActionImpl { + return s.probeAction +} + +func UnmarshalProbeActionImplementation(input []byte) (ProbeAction, 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 ProbeAction into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["type"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "ExecAction") { + var out ExecAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ExecAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "HTTPGetAction") { + var out HTTPGetAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into HTTPGetAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "TCPSocketAction") { + var out TCPSocketAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into TCPSocketAction: %+v", err) + } + return out, nil + } + + var parent BaseProbeActionImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseProbeActionImpl: %+v", err) + } + + return RawProbeActionImpl{ + probeAction: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_queuescalerule.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_queuescalerule.go new file mode 100644 index 00000000000..3681374b174 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_queuescalerule.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueueScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + QueueLength *int64 `json:"queueLength,omitempty"` + QueueName *string `json:"queueName,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_regeneratetestkeyrequestpayload.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_regeneratetestkeyrequestpayload.go new file mode 100644 index 00000000000..3f6a1c7d4e1 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_regeneratetestkeyrequestpayload.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateTestKeyRequestPayload struct { + KeyType TestKeyType `json:"keyType"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebugging.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebugging.go new file mode 100644 index 00000000000..6977018bcf2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebugging.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteDebugging struct { + Enabled *bool `json:"enabled,omitempty"` + Port *int64 `json:"port,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebuggingpayload.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebuggingpayload.go new file mode 100644 index 00000000000..25b3372481d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_remotedebuggingpayload.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteDebuggingPayload struct { + Port *int64 `json:"port,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_requiredtraffic.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_requiredtraffic.go new file mode 100644 index 00000000000..8ea811b3064 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_requiredtraffic.go @@ -0,0 +1,12 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RequiredTraffic struct { + Direction *TrafficDirection `json:"direction,omitempty"` + Fqdns *[]string `json:"fqdns,omitempty"` + IPs *[]string `json:"ips,omitempty"` + Port *int64 `json:"port,omitempty"` + Protocol *string `json:"protocol,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcerequests.go new file mode 100644 index 00000000000..08ca71575ad --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcerequests.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcesku.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcesku.go new file mode 100644 index 00000000000..3bc7d5f7838 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourcesku.go @@ -0,0 +1,14 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSku struct { + Capacity *SkuCapacity `json:"capacity,omitempty"` + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Name *string `json:"name,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskucapabilities.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskucapabilities.go new file mode 100644 index 00000000000..731a8c5986a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskucapabilities.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuCapabilities struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskulocationinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskulocationinfo.go new file mode 100644 index 00000000000..4e176631c15 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskulocationinfo.go @@ -0,0 +1,14 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuLocationInfo struct { + Location *string `json:"location,omitempty"` + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictioninfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictioninfo.go new file mode 100644 index 00000000000..5edc7c0a93b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictioninfo.go @@ -0,0 +1,13 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuRestrictionInfo struct { + Locations *[]string `json:"locations,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictions.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictions.go new file mode 100644 index 00000000000..6fe2faab5a8 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskurestrictions.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuRestrictions struct { + ReasonCode *ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + Type *ResourceSkuRestrictionsType `json:"type,omitempty"` + Values *[]string `json:"values,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskuzonedetails.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskuzonedetails.go new file mode 100644 index 00000000000..da6c8e0446d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceskuzonedetails.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuZoneDetails struct { + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` + Name *[]string `json:"name,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceuploaddefinition.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceuploaddefinition.go new file mode 100644 index 00000000000..a7e1eabb035 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_resourceuploaddefinition.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceUploadDefinition struct { + RelativePath *string `json:"relativePath,omitempty"` + UploadURL *string `json:"uploadUrl,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scale.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scale.go new file mode 100644 index 00000000000..dfbb52847ec --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scale.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Scale struct { + MaxReplicas *int64 `json:"maxReplicas,omitempty"` + MinReplicas *int64 `json:"minReplicas,omitempty"` + Rules *[]ScaleRule `json:"rules,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scalerule.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scalerule.go new file mode 100644 index 00000000000..cc54e843e81 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scalerule.go @@ -0,0 +1,12 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleRule struct { + AzureQueue *QueueScaleRule `json:"azureQueue,omitempty"` + Custom *CustomScaleRule `json:"custom,omitempty"` + HTTP *HTTPScaleRule `json:"http,omitempty"` + Name *string `json:"name,omitempty"` + Tcp *TcpScaleRule `json:"tcp,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scaleruleauth.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scaleruleauth.go new file mode 100644 index 00000000000..ad077d61e60 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_scaleruleauth.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleRuleAuth struct { + SecretRef *string `json:"secretRef,omitempty"` + TriggerParameter *string `json:"triggerParameter,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_secret.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_secret.go new file mode 100644 index 00000000000..eaf65188998 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_secret.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Secret struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryinstance.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryinstance.go new file mode 100644 index 00000000000..95d049a2767 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryinstance.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceRegistryInstance struct { + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryproperties.go new file mode 100644 index 00000000000..3de247cb4f7 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryproperties.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceRegistryProperties struct { + Instances *[]ServiceRegistryInstance `json:"instances,omitempty"` + ProvisioningState *ServiceRegistryProvisioningState `json:"provisioningState,omitempty"` + ResourceRequests *ServiceRegistryResourceRequests `json:"resourceRequests,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresource.go new file mode 100644 index 00000000000..581f7da5c1d --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceRegistryResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ServiceRegistryProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresourcerequests.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresourcerequests.go new file mode 100644 index 00000000000..f032d062935 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceregistryresourcerequests.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceRegistryResourceRequests struct { + Cpu *string `json:"cpu,omitempty"` + InstanceCount *int64 `json:"instanceCount,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceresource.go new file mode 100644 index 00000000000..3f9a0f6c8a2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_serviceresource.go @@ -0,0 +1,21 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceResource struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ClusterResourceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_servicevnetaddons.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_servicevnetaddons.go new file mode 100644 index 00000000000..11a5aa1cd05 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_servicevnetaddons.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceVNetAddons struct { + DataPlanePublicEndpoint *bool `json:"dataPlanePublicEndpoint,omitempty"` + LogStreamPublicEndpoint *bool `json:"logStreamPublicEndpoint,omitempty"` + PrivateDnsZoneId *string `json:"privateDnsZoneId,omitempty"` + PrivateStorageAccess *PrivateStorageAccess `json:"privateStorageAccess,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_sku.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_sku.go new file mode 100644 index 00000000000..a596965357f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_sku.go @@ -0,0 +1,10 @@ +package appplatform + +// 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"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_skucapacity.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_skucapacity.go new file mode 100644 index 00000000000..1d7277168f3 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_skucapacity.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuCapacity struct { + Default *int64 `json:"default,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + Minimum int64 `json:"minimum"` + ScaleType *SkuScaleType `json:"scaleType,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_skuobject.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_skuobject.go new file mode 100644 index 00000000000..49c4a39063b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_skuobject.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuObject struct { + Sku *Sku `json:"sku,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_sourceuploadedusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_sourceuploadedusersourceinfo.go new file mode 100644 index 00000000000..d2c37f2a640 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_sourceuploadedusersourceinfo.go @@ -0,0 +1,54 @@ +package appplatform + +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 _ UserSourceInfo = SourceUploadedUserSourceInfo{} + +type SourceUploadedUserSourceInfo struct { + ArtifactSelector *string `json:"artifactSelector,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s SourceUploadedUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = SourceUploadedUserSourceInfo{} + +func (s SourceUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper SourceUploadedUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SourceUploadedUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SourceUploadedUserSourceInfo: %+v", err) + } + + decoded["type"] = "Source" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SourceUploadedUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ssoproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ssoproperties.go new file mode 100644 index 00000000000..60c9ef373ae --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_ssoproperties.go @@ -0,0 +1,11 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SsoProperties struct { + ClientId *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + IssuerUri *string `json:"issuerUri,omitempty"` + Scope *[]string `json:"scope,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_stackproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_stackproperties.go new file mode 100644 index 00000000000..1147b765985 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_stackproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StackProperties struct { + Id *string `json:"id,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageaccount.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageaccount.go new file mode 100644 index 00000000000..6b25e6ecb18 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageaccount.go @@ -0,0 +1,51 @@ +package appplatform + +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 _ StorageProperties = StorageAccount{} + +type StorageAccount struct { + AccountKey string `json:"accountKey"` + AccountName string `json:"accountName"` + + // Fields inherited from StorageProperties + + StorageType StorageType `json:"storageType"` +} + +func (s StorageAccount) StorageProperties() BaseStoragePropertiesImpl { + return BaseStoragePropertiesImpl{ + StorageType: s.StorageType, + } +} + +var _ json.Marshaler = StorageAccount{} + +func (s StorageAccount) MarshalJSON() ([]byte, error) { + type wrapper StorageAccount + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling StorageAccount: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling StorageAccount: %+v", err) + } + + decoded["storageType"] = "StorageAccount" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling StorageAccount: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageproperties.go new file mode 100644 index 00000000000..eb6730a795a --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageproperties.go @@ -0,0 +1,75 @@ +package appplatform + +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 StorageProperties interface { + StorageProperties() BaseStoragePropertiesImpl +} + +var _ StorageProperties = BaseStoragePropertiesImpl{} + +type BaseStoragePropertiesImpl struct { + StorageType StorageType `json:"storageType"` +} + +func (s BaseStoragePropertiesImpl) StorageProperties() BaseStoragePropertiesImpl { + return s +} + +var _ StorageProperties = RawStoragePropertiesImpl{} + +// RawStoragePropertiesImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawStoragePropertiesImpl struct { + storageProperties BaseStoragePropertiesImpl + Type string + Values map[string]interface{} +} + +func (s RawStoragePropertiesImpl) StorageProperties() BaseStoragePropertiesImpl { + return s.storageProperties +} + +func UnmarshalStoragePropertiesImplementation(input []byte) (StorageProperties, 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 StorageProperties into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["storageType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "StorageAccount") { + var out StorageAccount + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into StorageAccount: %+v", err) + } + return out, nil + } + + var parent BaseStoragePropertiesImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseStoragePropertiesImpl: %+v", err) + } + + return RawStoragePropertiesImpl{ + storageProperties: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageresource.go new file mode 100644 index 00000000000..7e6eefb0933 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_storageresource.go @@ -0,0 +1,53 @@ +package appplatform + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties StorageProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &StorageResource{} + +func (s *StorageResource) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Id = decoded.Id + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling StorageResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := UnmarshalStoragePropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'StorageResource': %+v", err) + } + s.Properties = impl + } + + return nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedapmtype.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedapmtype.go new file mode 100644 index 00000000000..76bb17c9507 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedapmtype.go @@ -0,0 +1,8 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedApmType struct { + Name *string `json:"name,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresource.go new file mode 100644 index 00000000000..38af4b5dc13 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedBuildpackResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SupportedBuildpackResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresourceproperties.go new file mode 100644 index 00000000000..9c66c38893b --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedbuildpackresourceproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedBuildpackResourceProperties struct { + BuildpackId *string `json:"buildpackId,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedruntimeversion.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedruntimeversion.go new file mode 100644 index 00000000000..b111a877c26 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedruntimeversion.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedRuntimeVersion struct { + Platform *SupportedRuntimePlatform `json:"platform,omitempty"` + Value *SupportedRuntimeValue `json:"value,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedserverversion.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedserverversion.go new file mode 100644 index 00000000000..61df79ce0c5 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedserverversion.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedServerVersion struct { + Server *string `json:"server,omitempty"` + Value *string `json:"value,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresource.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresource.go new file mode 100644 index 00000000000..c2f8040e25c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresource.go @@ -0,0 +1,16 @@ +package appplatform + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedStackResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SupportedStackResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresourceproperties.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresourceproperties.go new file mode 100644 index 00000000000..4c3d40f4120 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_supportedstackresourceproperties.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedStackResourceProperties struct { + StackId *string `json:"stackId,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpscalerule.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpscalerule.go new file mode 100644 index 00000000000..31d915cc9f4 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpscalerule.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TcpScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpsocketaction.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpsocketaction.go new file mode 100644 index 00000000000..286aa3a4774 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_tcpsocketaction.go @@ -0,0 +1,49 @@ +package appplatform + +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 _ ProbeAction = TCPSocketAction{} + +type TCPSocketAction struct { + + // Fields inherited from ProbeAction + + Type ProbeActionType `json:"type"` +} + +func (s TCPSocketAction) ProbeAction() BaseProbeActionImpl { + return BaseProbeActionImpl{ + Type: s.Type, + } +} + +var _ json.Marshaler = TCPSocketAction{} + +func (s TCPSocketAction) MarshalJSON() ([]byte, error) { + type wrapper TCPSocketAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling TCPSocketAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling TCPSocketAction: %+v", err) + } + + decoded["type"] = "TCPSocketAction" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling TCPSocketAction: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_temporarydisk.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_temporarydisk.go new file mode 100644 index 00000000000..c373f759b6f --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_temporarydisk.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TemporaryDisk struct { + MountPath *string `json:"mountPath,omitempty"` + SizeInGB *int64 `json:"sizeInGB,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_testkeys.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_testkeys.go new file mode 100644 index 00000000000..7f0cd5ce47c --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_testkeys.go @@ -0,0 +1,12 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TestKeys struct { + Enabled *bool `json:"enabled,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + PrimaryTestEndpoint *string `json:"primaryTestEndpoint,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + SecondaryTestEndpoint *string `json:"secondaryTestEndpoint,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_triggeredbuildresult.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_triggeredbuildresult.go new file mode 100644 index 00000000000..f032578c200 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_triggeredbuildresult.go @@ -0,0 +1,31 @@ +package appplatform + +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 TriggeredBuildResult struct { + Id *string `json:"id,omitempty"` + Image *string `json:"image,omitempty"` + LastTransitionReason *string `json:"lastTransitionReason,omitempty"` + LastTransitionStatus *string `json:"lastTransitionStatus,omitempty"` + LastTransitionTime *string `json:"lastTransitionTime,omitempty"` + ProvisioningState *TriggeredBuildResultProvisioningState `json:"provisioningState,omitempty"` +} + +func (o *TriggeredBuildResult) GetLastTransitionTimeAsTime() (*time.Time, error) { + if o.LastTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *TriggeredBuildResult) SetLastTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastTransitionTime = &formatted +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_uploadedusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_uploadedusersourceinfo.go new file mode 100644 index 00000000000..c06453d2084 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_uploadedusersourceinfo.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ UserSourceInfo = UploadedUserSourceInfo{} + +type UploadedUserSourceInfo struct { + RelativePath *string `json:"relativePath,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s UploadedUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = UploadedUserSourceInfo{} + +func (s UploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper UploadedUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling UploadedUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling UploadedUserSourceInfo: %+v", err) + } + + decoded["type"] = "UploadedUserSourceInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling UploadedUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_usersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_usersourceinfo.go new file mode 100644 index 00000000000..59e546a1b81 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_usersourceinfo.go @@ -0,0 +1,124 @@ +package appplatform + +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 UserSourceInfo interface { + UserSourceInfo() BaseUserSourceInfoImpl +} + +var _ UserSourceInfo = BaseUserSourceInfoImpl{} + +type BaseUserSourceInfoImpl struct { + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s BaseUserSourceInfoImpl) UserSourceInfo() BaseUserSourceInfoImpl { + return s +} + +var _ UserSourceInfo = RawUserSourceInfoImpl{} + +// RawUserSourceInfoImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawUserSourceInfoImpl struct { + userSourceInfo BaseUserSourceInfoImpl + Type string + Values map[string]interface{} +} + +func (s RawUserSourceInfoImpl) UserSourceInfo() BaseUserSourceInfoImpl { + return s.userSourceInfo +} + +func UnmarshalUserSourceInfoImplementation(input []byte) (UserSourceInfo, 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 UserSourceInfo into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["type"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "BuildResult") { + var out BuildResultUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into BuildResultUserSourceInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Container") { + var out CustomContainerUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CustomContainerUserSourceInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Jar") { + var out JarUploadedUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into JarUploadedUserSourceInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "NetCoreZip") { + var out NetCoreZipUploadedUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into NetCoreZipUploadedUserSourceInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Source") { + var out SourceUploadedUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SourceUploadedUserSourceInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UploadedUserSourceInfo") { + var out UploadedUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into UploadedUserSourceInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "War") { + var out WarUploadedUserSourceInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into WarUploadedUserSourceInfo: %+v", err) + } + return out, nil + } + + var parent BaseUserSourceInfoImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseUserSourceInfoImpl: %+v", err) + } + + return RawUserSourceInfoImpl{ + userSourceInfo: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_validationmessages.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_validationmessages.go new file mode 100644 index 00000000000..e570fddc984 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_validationmessages.go @@ -0,0 +1,9 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidationMessages struct { + Messages *[]string `json:"messages,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_waruploadedusersourceinfo.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_waruploadedusersourceinfo.go new file mode 100644 index 00000000000..34b188ecaa2 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_waruploadedusersourceinfo.go @@ -0,0 +1,55 @@ +package appplatform + +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 _ UserSourceInfo = WarUploadedUserSourceInfo{} + +type WarUploadedUserSourceInfo struct { + JVMOptions *string `json:"jvmOptions,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + ServerVersion *string `json:"serverVersion,omitempty"` + + // Fields inherited from UserSourceInfo + + Type string `json:"type"` + Version *string `json:"version,omitempty"` +} + +func (s WarUploadedUserSourceInfo) UserSourceInfo() BaseUserSourceInfoImpl { + return BaseUserSourceInfoImpl{ + Type: s.Type, + Version: s.Version, + } +} + +var _ json.Marshaler = WarUploadedUserSourceInfo{} + +func (s WarUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + type wrapper WarUploadedUserSourceInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling WarUploadedUserSourceInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling WarUploadedUserSourceInfo: %+v", err) + } + + decoded["type"] = "War" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling WarUploadedUserSourceInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/model_weeklymaintenancescheduleconfiguration.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_weeklymaintenancescheduleconfiguration.go new file mode 100644 index 00000000000..c97bbab6f60 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/model_weeklymaintenancescheduleconfiguration.go @@ -0,0 +1,52 @@ +package appplatform + +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 _ MaintenanceScheduleConfiguration = WeeklyMaintenanceScheduleConfiguration{} + +type WeeklyMaintenanceScheduleConfiguration struct { + Day WeekDay `json:"day"` + Duration *string `json:"duration,omitempty"` + Hour int64 `json:"hour"` + + // Fields inherited from MaintenanceScheduleConfiguration + + Frequency Frequency `json:"frequency"` +} + +func (s WeeklyMaintenanceScheduleConfiguration) MaintenanceScheduleConfiguration() BaseMaintenanceScheduleConfigurationImpl { + return BaseMaintenanceScheduleConfigurationImpl{ + Frequency: s.Frequency, + } +} + +var _ json.Marshaler = WeeklyMaintenanceScheduleConfiguration{} + +func (s WeeklyMaintenanceScheduleConfiguration) MarshalJSON() ([]byte, error) { + type wrapper WeeklyMaintenanceScheduleConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling WeeklyMaintenanceScheduleConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling WeeklyMaintenanceScheduleConfiguration: %+v", err) + } + + decoded["frequency"] = "Weekly" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling WeeklyMaintenanceScheduleConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/appplatform/2024-05-01-preview/appplatform/predicates.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/predicates.go new file mode 100644 index 00000000000..b5b69918bff --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/predicates.go @@ -0,0 +1,832 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiPortalCustomDomainResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiPortalCustomDomainResourceOperationPredicate) Matches(input ApiPortalCustomDomainResource) 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 +} + +type ApiPortalResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApiPortalResourceOperationPredicate) Matches(input ApiPortalResource) 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 +} + +type ApmResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApmResourceOperationPredicate) Matches(input ApmResource) 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 +} + +type AppResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AppResourceOperationPredicate) Matches(input AppResource) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + 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 +} + +type ApplicationAcceleratorResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApplicationAcceleratorResourceOperationPredicate) Matches(input ApplicationAcceleratorResource) 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 +} + +type ApplicationLiveViewResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApplicationLiveViewResourceOperationPredicate) Matches(input ApplicationLiveViewResource) 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 +} + +type BindingResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BindingResourceOperationPredicate) Matches(input BindingResource) 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 +} + +type BuildOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BuildOperationPredicate) Matches(input Build) 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 +} + +type BuildResultOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BuildResultOperationPredicate) Matches(input BuildResult) 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 +} + +type BuildServiceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BuildServiceOperationPredicate) Matches(input BuildService) 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 +} + +type BuildServiceAgentPoolResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BuildServiceAgentPoolResourceOperationPredicate) Matches(input BuildServiceAgentPoolResource) 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 +} + +type BuilderResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BuilderResourceOperationPredicate) Matches(input BuilderResource) 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 +} + +type BuildpackBindingResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BuildpackBindingResourceOperationPredicate) Matches(input BuildpackBindingResource) 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 +} + +type CertificateResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CertificateResourceOperationPredicate) Matches(input CertificateResource) 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 +} + +type ConfigServerResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ConfigServerResourceOperationPredicate) Matches(input ConfigServerResource) 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 +} + +type ConfigurationServiceResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ConfigurationServiceResourceOperationPredicate) Matches(input ConfigurationServiceResource) 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 +} + +type ContainerRegistryResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ContainerRegistryResourceOperationPredicate) Matches(input ContainerRegistryResource) 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 +} + +type CustomDomainResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CustomDomainResourceOperationPredicate) Matches(input CustomDomainResource) 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 +} + +type CustomizedAcceleratorResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CustomizedAcceleratorResourceOperationPredicate) Matches(input CustomizedAcceleratorResource) 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 +} + +type DeploymentResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DeploymentResourceOperationPredicate) Matches(input DeploymentResource) 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 +} + +type DevToolPortalResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DevToolPortalResourceOperationPredicate) Matches(input DevToolPortalResource) 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 +} + +type EurekaServerResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p EurekaServerResourceOperationPredicate) Matches(input EurekaServerResource) 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 +} + +type GatewayCustomDomainResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GatewayCustomDomainResourceOperationPredicate) Matches(input GatewayCustomDomainResource) 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 +} + +type GatewayResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GatewayResourceOperationPredicate) Matches(input GatewayResource) 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 +} + +type GatewayRouteConfigResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GatewayRouteConfigResourceOperationPredicate) Matches(input GatewayRouteConfigResource) 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 +} + +type JobExecutionOperationPredicate struct { + EndTime *string + Name *string + StartTime *string +} + +func (p JobExecutionOperationPredicate) Matches(input JobExecution) bool { + + if p.EndTime != nil && (input.EndTime == nil || *p.EndTime != *input.EndTime) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.StartTime != nil && (input.StartTime == nil || *p.StartTime != *input.StartTime) { + return false + } + + return true +} + +type JobResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p JobResourceOperationPredicate) Matches(input JobResource) 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 +} + +type PredefinedAcceleratorResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PredefinedAcceleratorResourceOperationPredicate) Matches(input PredefinedAcceleratorResource) 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 +} + +type ResourceSkuOperationPredicate struct { + Name *string + ResourceType *string + Tier *string +} + +func (p ResourceSkuOperationPredicate) Matches(input ResourceSku) bool { + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.ResourceType != nil && (input.ResourceType == nil || *p.ResourceType != *input.ResourceType) { + return false + } + + if p.Tier != nil && (input.Tier == nil || *p.Tier != *input.Tier) { + return false + } + + return true +} + +type ServiceRegistryResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ServiceRegistryResourceOperationPredicate) Matches(input ServiceRegistryResource) 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 +} + +type ServiceResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ServiceResourceOperationPredicate) Matches(input ServiceResource) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + 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 +} + +type StorageResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p StorageResourceOperationPredicate) Matches(input StorageResource) 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 +} + +type SupportedApmTypeOperationPredicate struct { + Name *string +} + +func (p SupportedApmTypeOperationPredicate) Matches(input SupportedApmType) bool { + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + return true +} + +type SupportedBuildpackResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SupportedBuildpackResourceOperationPredicate) Matches(input SupportedBuildpackResource) 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 +} + +type SupportedServerVersionOperationPredicate struct { + Server *string + Value *string + Version *string +} + +func (p SupportedServerVersionOperationPredicate) Matches(input SupportedServerVersion) bool { + + if p.Server != nil && (input.Server == nil || *p.Server != *input.Server) { + return false + } + + if p.Value != nil && (input.Value == nil || *p.Value != *input.Value) { + return false + } + + if p.Version != nil && (input.Version == nil || *p.Version != *input.Version) { + return false + } + + return true +} + +type SupportedStackResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SupportedStackResourceOperationPredicate) Matches(input SupportedStackResource) 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/resource-manager/appplatform/2024-05-01-preview/appplatform/version.go b/resource-manager/appplatform/2024-05-01-preview/appplatform/version.go new file mode 100644 index 00000000000..8b9429293e0 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/appplatform/version.go @@ -0,0 +1,10 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-05-01-preview" + +func userAgent() string { + return "hashicorp/go-azure-sdk/appplatform/2024-05-01-preview" +} diff --git a/resource-manager/appplatform/2024-05-01-preview/client.go b/resource-manager/appplatform/2024-05-01-preview/client.go new file mode 100644 index 00000000000..dac8f1d6cf9 --- /dev/null +++ b/resource-manager/appplatform/2024-05-01-preview/client.go @@ -0,0 +1,28 @@ +package v2024_05_01_preview + +// 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/appplatform/2024-05-01-preview/appplatform" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AppPlatform *appplatform.AppPlatformClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + appPlatformClient, err := appplatform.NewAppPlatformClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AppPlatform client: %+v", err) + } + configureFunc(appPlatformClient.Client) + + return &Client{ + AppPlatform: appPlatformClient, + }, nil +} diff --git a/resource-manager/datamigration/2021-06-30/customoperation/model_connectioninfo.go b/resource-manager/datamigration/2021-06-30/customoperation/model_connectioninfo.go index b900b18932b..1e62657e3a1 100644 --- a/resource-manager/datamigration/2021-06-30/customoperation/model_connectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/customoperation/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/customoperation/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2021-06-30/customoperation/model_mongodbconnectioninfo.go index c0afdd8d08a..1c31efa87cc 100644 --- a/resource-manager/datamigration/2021-06-30/customoperation/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/customoperation/model_mongodbconnectioninfo.go @@ -43,7 +43,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2021-06-30/get/model_connectioninfo.go b/resource-manager/datamigration/2021-06-30/get/model_connectioninfo.go index 17449325861..7f4ef6edd53 100644 --- a/resource-manager/datamigration/2021-06-30/get/model_connectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/get/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/get/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2021-06-30/get/model_mongodbconnectioninfo.go index e186e5fe8d9..f5b37624ce2 100644 --- a/resource-manager/datamigration/2021-06-30/get/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/get/model_mongodbconnectioninfo.go @@ -43,7 +43,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2021-06-30/serviceresource/model_connectioninfo.go b/resource-manager/datamigration/2021-06-30/serviceresource/model_connectioninfo.go index 3047b7e0a50..6e9f1a364e2 100644 --- a/resource-manager/datamigration/2021-06-30/serviceresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/serviceresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/serviceresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2021-06-30/serviceresource/model_mongodbconnectioninfo.go index d9ee0a79824..1cf3c01e27d 100644 --- a/resource-manager/datamigration/2021-06-30/serviceresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/serviceresource/model_mongodbconnectioninfo.go @@ -43,7 +43,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2021-06-30/servicetaskresource/model_connectioninfo.go b/resource-manager/datamigration/2021-06-30/servicetaskresource/model_connectioninfo.go index ec590fac48b..a2c64b788f0 100644 --- a/resource-manager/datamigration/2021-06-30/servicetaskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/servicetaskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/servicetaskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2021-06-30/servicetaskresource/model_mongodbconnectioninfo.go index 7dc42b8a963..7fc6889bf68 100644 --- a/resource-manager/datamigration/2021-06-30/servicetaskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/servicetaskresource/model_mongodbconnectioninfo.go @@ -43,7 +43,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/model_connectioninfo.go b/resource-manager/datamigration/2021-06-30/standardoperation/model_connectioninfo.go index a817745d831..ec4f109cdf0 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/model_connectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2021-06-30/standardoperation/model_mongodbconnectioninfo.go index e8e61583e26..10e0b5478d8 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/model_mongodbconnectioninfo.go @@ -43,7 +43,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2021-06-30/taskresource/model_connectioninfo.go b/resource-manager/datamigration/2021-06-30/taskresource/model_connectioninfo.go index 41c28de5b58..75a9f172f04 100644 --- a/resource-manager/datamigration/2021-06-30/taskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/taskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/taskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2021-06-30/taskresource/model_mongodbconnectioninfo.go index edc21ffacf0..bd9bb51546f 100644 --- a/resource-manager/datamigration/2021-06-30/taskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2021-06-30/taskresource/model_mongodbconnectioninfo.go @@ -43,7 +43,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil {