From 52a34a8afcbbdf29edf4d668f814ed408e452924 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 23 Jun 2022 21:06:18 +0000 Subject: [PATCH] feat: Enable REST transport for most of Java and Go clients (#236) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 456641589 Source-Link: https://github.com/googleapis/googleapis/commit/8a251f5225b789b2383207ffd978f6aa3d77fcf7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9 --- java-domains/README.md | 4 +- java-domains/google-cloud-domains/pom.xml | 16 + .../cloud/domains/v1/DomainsClient.java | 37 +- .../cloud/domains/v1/DomainsSettings.java | 23 +- .../cloud/domains/v1/stub/DomainsStub.java | 6 +- .../domains/v1/stub/DomainsStubSettings.java | 52 +- .../stub/HttpJsonDomainsCallableFactory.java | 105 + .../domains/v1/stub/HttpJsonDomainsStub.java | 1137 +++++++++++ .../cloud/domains/v1alpha2/DomainsClient.java | 37 +- .../domains/v1alpha2/DomainsSettings.java | 23 +- .../domains/v1alpha2/stub/DomainsStub.java | 6 +- .../v1alpha2/stub/DomainsStubSettings.java | 52 +- .../stub/HttpJsonDomainsCallableFactory.java | 105 + .../v1alpha2/stub/HttpJsonDomainsStub.java | 1138 +++++++++++ .../cloud/domains/v1beta1/DomainsClient.java | 37 +- .../domains/v1beta1/DomainsSettings.java | 23 +- .../domains/v1beta1/stub/DomainsStub.java | 6 +- .../v1beta1/stub/DomainsStubSettings.java | 52 +- .../stub/HttpJsonDomainsCallableFactory.java | 105 + .../v1beta1/stub/HttpJsonDomainsStub.java | 1137 +++++++++++ .../domains/v1/DomainsClientHttpJsonTest.java | 1700 +++++++++++++++++ .../v1alpha2/DomainsClientHttpJsonTest.java | 1700 +++++++++++++++++ .../v1beta1/DomainsClientHttpJsonTest.java | 1700 +++++++++++++++++ .../AsyncConfigureContactSettings.java | 56 + .../AsyncConfigureContactSettingsLRO.java | 57 + .../SyncConfigureContactSettings.java | 52 + ...istrationnameContactsettingsFieldmask.java | 50 + ...ettingsStringContactsettingsFieldmask.java | 49 + .../AsyncConfigureDnsSettings.java | 53 + .../AsyncConfigureDnsSettingsLRO.java | 54 + .../SyncConfigureDnsSettings.java | 49 + ...sRegistrationnameDnssettingsFieldmask.java | 48 + ...DnsSettingsStringDnssettingsFieldmask.java | 45 + .../AsyncConfigureManagementSettings.java | 52 + .../AsyncConfigureManagementSettingsLRO.java | 53 + .../SyncConfigureManagementSettings.java | 48 + ...rationnameManagementsettingsFieldmask.java | 50 + ...ingsStringManagementsettingsFieldmask.java | 50 + .../SyncCreateSetCredentialsProvider.java | 41 + .../SyncCreateSetCredentialsProvider1.java | 40 + .../create/SyncCreateSetEndpoint.java | 37 + .../AsyncDeleteRegistration.java | 46 + .../AsyncDeleteRegistrationLRO.java | 48 + .../SyncDeleteRegistration.java | 42 + ...yncDeleteRegistrationRegistrationname.java | 38 + .../SyncDeleteRegistrationString.java | 38 + .../AsyncExportRegistration.java | 46 + .../AsyncExportRegistrationLRO.java | 48 + .../SyncExportRegistration.java | 43 + ...yncExportRegistrationRegistrationname.java | 39 + .../SyncExportRegistrationString.java | 39 + .../getregistration/AsyncGetRegistration.java | 46 + .../getregistration/SyncGetRegistration.java | 43 + .../SyncGetRegistrationRegistrationname.java | 39 + .../SyncGetRegistrationString.java | 39 + .../AsyncListRegistrations.java | 52 + .../AsyncListRegistrationsPaged.java | 60 + .../SyncListRegistrations.java | 48 + .../SyncListRegistrationsLocationname.java | 41 + .../SyncListRegistrationsString.java | 41 + .../registerdomain/AsyncRegisterDomain.java | 56 + .../AsyncRegisterDomainLRO.java | 57 + .../registerdomain/SyncRegisterDomain.java | 52 + ...erDomainLocationnameRegistrationMoney.java | 43 + ...RegisterDomainStringRegistrationMoney.java | 43 + .../AsyncResetAuthorizationCode.java | 48 + .../SyncResetAuthorizationCode.java | 44 + ...esetAuthorizationCodeRegistrationname.java | 40 + .../SyncResetAuthorizationCodeString.java | 40 + .../AsyncRetrieveAuthorizationCode.java | 48 + .../SyncRetrieveAuthorizationCode.java | 44 + ...ieveAuthorizationCodeRegistrationname.java | 40 + .../SyncRetrieveAuthorizationCodeString.java | 40 + .../AsyncRetrieveRegisterParameters.java | 48 + .../SyncRetrieveRegisterParameters.java | 45 + ...eRegisterParametersLocationnameString.java | 41 + ...etrieveRegisterParametersStringString.java | 41 + .../AsyncRetrieveTransferParameters.java | 48 + .../SyncRetrieveTransferParameters.java | 45 + ...eTransferParametersLocationnameString.java | 41 + ...etrieveTransferParametersStringString.java | 41 + .../searchdomains/AsyncSearchDomains.java | 48 + .../searchdomains/SyncSearchDomains.java | 44 + .../SyncSearchDomainsLocationnameString.java | 40 + .../SyncSearchDomainsStringString.java | 40 + .../transferdomain/AsyncTransferDomain.java | 56 + .../AsyncTransferDomainLRO.java | 57 + .../transferdomain/SyncTransferDomain.java | 52 + ...ameRegistrationMoneyAuthorizationcode.java | 50 + ...ingRegistrationMoneyAuthorizationcode.java | 49 + .../AsyncUpdateRegistration.java | 48 + .../AsyncUpdateRegistrationLRO.java | 49 + .../SyncUpdateRegistration.java | 44 + ...dateRegistrationRegistrationFieldmask.java | 40 + .../searchdomains/SyncSearchDomains.java | 45 + .../searchdomains/SyncSearchDomains.java | 45 + .../AsyncConfigureContactSettings.java | 56 + .../AsyncConfigureContactSettingsLRO.java | 57 + .../SyncConfigureContactSettings.java | 52 + ...istrationnameContactsettingsFieldmask.java | 50 + ...ettingsStringContactsettingsFieldmask.java | 49 + .../AsyncConfigureDnsSettings.java | 53 + .../AsyncConfigureDnsSettingsLRO.java | 54 + .../SyncConfigureDnsSettings.java | 49 + ...sRegistrationnameDnssettingsFieldmask.java | 48 + ...DnsSettingsStringDnssettingsFieldmask.java | 47 + .../AsyncConfigureManagementSettings.java | 52 + .../AsyncConfigureManagementSettingsLRO.java | 53 + .../SyncConfigureManagementSettings.java | 48 + ...rationnameManagementsettingsFieldmask.java | 50 + ...ingsStringManagementsettingsFieldmask.java | 50 + .../SyncCreateSetCredentialsProvider.java | 41 + .../SyncCreateSetCredentialsProvider1.java | 40 + .../create/SyncCreateSetEndpoint.java | 37 + .../AsyncDeleteRegistration.java | 46 + .../AsyncDeleteRegistrationLRO.java | 48 + .../SyncDeleteRegistration.java | 42 + ...yncDeleteRegistrationRegistrationname.java | 38 + .../SyncDeleteRegistrationString.java | 38 + .../AsyncExportRegistration.java | 46 + .../AsyncExportRegistrationLRO.java | 48 + .../SyncExportRegistration.java | 43 + ...yncExportRegistrationRegistrationname.java | 39 + .../SyncExportRegistrationString.java | 39 + .../getregistration/AsyncGetRegistration.java | 46 + .../getregistration/SyncGetRegistration.java | 43 + .../SyncGetRegistrationRegistrationname.java | 39 + .../SyncGetRegistrationString.java | 39 + .../AsyncListRegistrations.java | 52 + .../AsyncListRegistrationsPaged.java | 60 + .../SyncListRegistrations.java | 48 + .../SyncListRegistrationsLocationname.java | 41 + .../SyncListRegistrationsString.java | 41 + .../registerdomain/AsyncRegisterDomain.java | 56 + .../AsyncRegisterDomainLRO.java | 57 + .../registerdomain/SyncRegisterDomain.java | 52 + ...erDomainLocationnameRegistrationMoney.java | 44 + ...RegisterDomainStringRegistrationMoney.java | 43 + .../AsyncResetAuthorizationCode.java | 48 + .../SyncResetAuthorizationCode.java | 44 + ...esetAuthorizationCodeRegistrationname.java | 40 + .../SyncResetAuthorizationCodeString.java | 40 + .../AsyncRetrieveAuthorizationCode.java | 48 + .../SyncRetrieveAuthorizationCode.java | 44 + ...ieveAuthorizationCodeRegistrationname.java | 40 + .../SyncRetrieveAuthorizationCodeString.java | 40 + .../AsyncRetrieveRegisterParameters.java | 48 + .../SyncRetrieveRegisterParameters.java | 45 + ...eRegisterParametersLocationnameString.java | 42 + ...etrieveRegisterParametersStringString.java | 41 + .../AsyncRetrieveTransferParameters.java | 48 + .../SyncRetrieveTransferParameters.java | 45 + ...eTransferParametersLocationnameString.java | 42 + ...etrieveTransferParametersStringString.java | 41 + .../searchdomains/AsyncSearchDomains.java | 48 + .../searchdomains/SyncSearchDomains.java | 44 + .../SyncSearchDomainsLocationnameString.java | 40 + .../SyncSearchDomainsStringString.java | 40 + .../transferdomain/AsyncTransferDomain.java | 56 + .../AsyncTransferDomainLRO.java | 57 + .../transferdomain/SyncTransferDomain.java | 52 + ...ameRegistrationMoneyAuthorizationcode.java | 50 + ...ingRegistrationMoneyAuthorizationcode.java | 49 + .../AsyncUpdateRegistration.java | 48 + .../AsyncUpdateRegistrationLRO.java | 49 + .../SyncUpdateRegistration.java | 44 + ...dateRegistrationRegistrationFieldmask.java | 40 + .../searchdomains/SyncSearchDomains.java | 45 + .../searchdomains/SyncSearchDomains.java | 45 + .../AsyncConfigureContactSettings.java | 56 + .../AsyncConfigureContactSettingsLRO.java | 57 + .../SyncConfigureContactSettings.java | 52 + ...istrationnameContactsettingsFieldmask.java | 50 + ...ettingsStringContactsettingsFieldmask.java | 49 + .../AsyncConfigureDnsSettings.java | 53 + .../AsyncConfigureDnsSettingsLRO.java | 54 + .../SyncConfigureDnsSettings.java | 49 + ...sRegistrationnameDnssettingsFieldmask.java | 48 + ...DnsSettingsStringDnssettingsFieldmask.java | 47 + .../AsyncConfigureManagementSettings.java | 52 + .../AsyncConfigureManagementSettingsLRO.java | 53 + .../SyncConfigureManagementSettings.java | 48 + ...rationnameManagementsettingsFieldmask.java | 50 + ...ingsStringManagementsettingsFieldmask.java | 50 + .../SyncCreateSetCredentialsProvider.java | 41 + .../SyncCreateSetCredentialsProvider1.java | 40 + .../create/SyncCreateSetEndpoint.java | 37 + .../AsyncDeleteRegistration.java | 46 + .../AsyncDeleteRegistrationLRO.java | 48 + .../SyncDeleteRegistration.java | 42 + ...yncDeleteRegistrationRegistrationname.java | 38 + .../SyncDeleteRegistrationString.java | 38 + .../AsyncExportRegistration.java | 46 + .../AsyncExportRegistrationLRO.java | 48 + .../SyncExportRegistration.java | 43 + ...yncExportRegistrationRegistrationname.java | 39 + .../SyncExportRegistrationString.java | 39 + .../getregistration/AsyncGetRegistration.java | 46 + .../getregistration/SyncGetRegistration.java | 43 + .../SyncGetRegistrationRegistrationname.java | 39 + .../SyncGetRegistrationString.java | 39 + .../AsyncListRegistrations.java | 52 + .../AsyncListRegistrationsPaged.java | 60 + .../SyncListRegistrations.java | 48 + .../SyncListRegistrationsLocationname.java | 41 + .../SyncListRegistrationsString.java | 41 + .../registerdomain/AsyncRegisterDomain.java | 56 + .../AsyncRegisterDomainLRO.java | 57 + .../registerdomain/SyncRegisterDomain.java | 52 + ...erDomainLocationnameRegistrationMoney.java | 43 + ...RegisterDomainStringRegistrationMoney.java | 43 + .../AsyncResetAuthorizationCode.java | 48 + .../SyncResetAuthorizationCode.java | 44 + ...esetAuthorizationCodeRegistrationname.java | 40 + .../SyncResetAuthorizationCodeString.java | 40 + .../AsyncRetrieveAuthorizationCode.java | 48 + .../SyncRetrieveAuthorizationCode.java | 44 + ...ieveAuthorizationCodeRegistrationname.java | 40 + .../SyncRetrieveAuthorizationCodeString.java | 40 + .../AsyncRetrieveRegisterParameters.java | 48 + .../SyncRetrieveRegisterParameters.java | 45 + ...eRegisterParametersLocationnameString.java | 42 + ...etrieveRegisterParametersStringString.java | 41 + .../AsyncRetrieveTransferParameters.java | 48 + .../SyncRetrieveTransferParameters.java | 45 + ...eTransferParametersLocationnameString.java | 42 + ...etrieveTransferParametersStringString.java | 41 + .../searchdomains/AsyncSearchDomains.java | 48 + .../searchdomains/SyncSearchDomains.java | 44 + .../SyncSearchDomainsLocationnameString.java | 40 + .../SyncSearchDomainsStringString.java | 40 + .../transferdomain/AsyncTransferDomain.java | 56 + .../AsyncTransferDomainLRO.java | 57 + .../transferdomain/SyncTransferDomain.java | 52 + ...ameRegistrationMoneyAuthorizationcode.java | 50 + ...ingRegistrationMoneyAuthorizationcode.java | 49 + .../AsyncUpdateRegistration.java | 48 + .../AsyncUpdateRegistrationLRO.java | 49 + .../SyncUpdateRegistration.java | 44 + ...dateRegistrationRegistrationFieldmask.java | 40 + .../searchdomains/SyncSearchDomains.java | 45 + .../searchdomains/SyncSearchDomains.java | 45 + 242 files changed, 19291 insertions(+), 35 deletions(-) create mode 100644 java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.java create mode 100644 java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java create mode 100644 java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.java create mode 100644 java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java create mode 100644 java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.java create mode 100644 java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java create mode 100644 java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java create mode 100644 java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java create mode 100644 java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.java create mode 100644 java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java diff --git a/java-domains/README.md b/java-domains/README.md index 804d0d84d330..b5123226ec46 100644 --- a/java-domains/README.md +++ b/java-domains/README.md @@ -27,13 +27,13 @@ If you are using Maven, add this to your pom.xml file: If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-domains:0.6.0' +implementation 'com.google.cloud:google-cloud-domains:0.6.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-domains" % "0.6.0" +libraryDependencies += "com.google.cloud" % "google-cloud-domains" % "0.6.1" ``` ## Authentication diff --git a/java-domains/google-cloud-domains/pom.xml b/java-domains/google-cloud-domains/pom.xml index d85613ecdbac..7d295c0136d6 100644 --- a/java-domains/google-cloud-domains/pom.xml +++ b/java-domains/google-cloud-domains/pom.xml @@ -66,6 +66,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -95,12 +99,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java index f984f6bf78b2..a697fd4d6f5b 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsClient.java @@ -19,6 +19,7 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -30,7 +31,6 @@ import com.google.cloud.domains.v1.stub.DomainsStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.type.Money; @@ -103,13 +103,28 @@ * DomainsClient domainsClient = DomainsClient.create(domainsSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * DomainsSettings domainsSettings =
+ *     DomainsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DomainsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DomainsClient domainsClient = DomainsClient.create(domainsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class DomainsClient implements BackgroundResource { private final DomainsSettings settings; private final DomainsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DomainsClient with default settings. */ public static final DomainsClient create() throws IOException { @@ -139,13 +154,17 @@ public static final DomainsClient create(DomainsStub stub) { protected DomainsClient(DomainsSettings settings) throws IOException { this.settings = settings; this.stub = ((DomainsStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected DomainsClient(DomainsStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final DomainsSettings getSettings() { @@ -160,10 +179,18 @@ public DomainsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Searches for available domain names similar to the provided query. diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java index 7a6ade9c8902..e1b7cc49f1eb 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/DomainsSettings.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -228,11 +229,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DomainsStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return DomainsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DomainsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DomainsStubSettings.defaultTransportChannelProvider(); } @@ -242,11 +250,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DomainsStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -284,6 +298,11 @@ private static Builder createDefault() { return new Builder(DomainsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DomainsStubSettings.newHttpJsonBuilder()); + } + public DomainsStubSettings.Builder getStubSettingsBuilder() { return ((DomainsStubSettings.Builder) getStubSettings()); } diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java index 87c1dc6132ca..bda9889c07b7 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStub.java @@ -58,7 +58,11 @@ public abstract class DomainsStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable searchDomainsCallable() { diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java index bd2900634651..77bd965e51f0 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/DomainsStubSettings.java @@ -28,6 +28,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -360,6 +363,11 @@ public DomainsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDomainsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDomainsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -392,29 +400,54 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DomainsStubSettings.class)) .setTransportToken( GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DomainsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DomainsStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -658,6 +691,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .searchDomainsSettings() diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.java new file mode 100644 index 000000000000..270f0dc698d5 --- /dev/null +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Domains service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDomainsCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java new file mode 100644 index 000000000000..ff46eff7a9ff --- /dev/null +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1/stub/HttpJsonDomainsStub.java @@ -0,0 +1,1137 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.stub; + +import static com.google.cloud.domains.v1.DomainsClient.ListRegistrationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.GetRegistrationRequest; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.ListRegistrationsResponse; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.ResetAuthorizationCodeRequest; +import com.google.cloud.domains.v1.RetrieveAuthorizationCodeRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; +import com.google.cloud.domains.v1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; +import com.google.cloud.domains.v1.SearchDomainsRequest; +import com.google.cloud.domains.v1.SearchDomainsResponse; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Domains service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDomainsStub extends DomainsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(OperationMetadata.getDescriptor()) + .add(Empty.getDescriptor()) + .add(Registration.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + searchDomainsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/SearchDomains") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/registrations:searchDomains", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchDomainsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + RetrieveRegisterParametersRequest, RetrieveRegisterParametersResponse> + retrieveRegisterParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RetrieveRegisterParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/registrations:retrieveRegisterParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveRegisterParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RegisterDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/registrations:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RegisterDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + RetrieveTransferParametersRequest, RetrieveTransferParametersResponse> + retrieveTransferParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RetrieveTransferParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/registrations:retrieveTransferParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveTransferParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + transferDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/TransferDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/registrations:transfer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (TransferDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRegistrationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ListRegistrations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/registrations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRegistrationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/GetRegistration") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Registration.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/UpdateRegistration") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration.name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration.name", request.getRegistration().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("registration", request.getRegistration())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureManagementSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ConfigureManagementSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:configureManagementSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureManagementSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureDnsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ConfigureDnsSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:configureDnsSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureDnsSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureContactSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ConfigureContactSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:configureContactSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureContactSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + exportRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ExportRegistration") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/registrations/*}:export", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/DeleteRegistration") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + retrieveAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/RetrieveAuthorizationCode") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:retrieveAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + resetAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1.Domains/ResetAuthorizationCode") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{registration=projects/*/locations/*/registrations/*}:resetAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchDomainsCallable; + private final UnaryCallable + retrieveRegisterParametersCallable; + private final UnaryCallable registerDomainCallable; + private final OperationCallable + registerDomainOperationCallable; + private final UnaryCallable + retrieveTransferParametersCallable; + private final UnaryCallable transferDomainCallable; + private final OperationCallable + transferDomainOperationCallable; + private final UnaryCallable + listRegistrationsCallable; + private final UnaryCallable + listRegistrationsPagedCallable; + private final UnaryCallable getRegistrationCallable; + private final UnaryCallable updateRegistrationCallable; + private final OperationCallable + updateRegistrationOperationCallable; + private final UnaryCallable + configureManagementSettingsCallable; + private final OperationCallable< + ConfigureManagementSettingsRequest, Registration, OperationMetadata> + configureManagementSettingsOperationCallable; + private final UnaryCallable configureDnsSettingsCallable; + private final OperationCallable + configureDnsSettingsOperationCallable; + private final UnaryCallable + configureContactSettingsCallable; + private final OperationCallable + configureContactSettingsOperationCallable; + private final UnaryCallable exportRegistrationCallable; + private final OperationCallable + exportRegistrationOperationCallable; + private final UnaryCallable deleteRegistrationCallable; + private final OperationCallable + deleteRegistrationOperationCallable; + private final UnaryCallable + retrieveAuthorizationCodeCallable; + private final UnaryCallable + resetAuthorizationCodeCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDomainsStub create(DomainsStubSettings settings) throws IOException { + return new HttpJsonDomainsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDomainsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDomainsStub(DomainsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDomainsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDomainsStub( + DomainsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDomainsStub(DomainsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDomainsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDomainsStub( + DomainsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + searchDomainsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchDomainsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveRegisterParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveRegisterParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings registerDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveTransferParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveTransferParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings transferDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRegistrationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegistrationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureManagementSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureManagementSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureDnsSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureDnsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureContactSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureContactSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(retrieveAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + resetAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchDomainsCallable = + callableFactory.createUnaryCallable( + searchDomainsTransportSettings, settings.searchDomainsSettings(), clientContext); + this.retrieveRegisterParametersCallable = + callableFactory.createUnaryCallable( + retrieveRegisterParametersTransportSettings, + settings.retrieveRegisterParametersSettings(), + clientContext); + this.registerDomainCallable = + callableFactory.createUnaryCallable( + registerDomainTransportSettings, settings.registerDomainSettings(), clientContext); + this.registerDomainOperationCallable = + callableFactory.createOperationCallable( + registerDomainTransportSettings, + settings.registerDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveTransferParametersCallable = + callableFactory.createUnaryCallable( + retrieveTransferParametersTransportSettings, + settings.retrieveTransferParametersSettings(), + clientContext); + this.transferDomainCallable = + callableFactory.createUnaryCallable( + transferDomainTransportSettings, settings.transferDomainSettings(), clientContext); + this.transferDomainOperationCallable = + callableFactory.createOperationCallable( + transferDomainTransportSettings, + settings.transferDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRegistrationsCallable = + callableFactory.createUnaryCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.listRegistrationsPagedCallable = + callableFactory.createPagedCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.getRegistrationCallable = + callableFactory.createUnaryCallable( + getRegistrationTransportSettings, settings.getRegistrationSettings(), clientContext); + this.updateRegistrationCallable = + callableFactory.createUnaryCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationSettings(), + clientContext); + this.updateRegistrationOperationCallable = + callableFactory.createOperationCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureManagementSettingsCallable = + callableFactory.createUnaryCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsSettings(), + clientContext); + this.configureManagementSettingsOperationCallable = + callableFactory.createOperationCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureDnsSettingsCallable = + callableFactory.createUnaryCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsSettings(), + clientContext); + this.configureDnsSettingsOperationCallable = + callableFactory.createOperationCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureContactSettingsCallable = + callableFactory.createUnaryCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsSettings(), + clientContext); + this.configureContactSettingsOperationCallable = + callableFactory.createOperationCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.exportRegistrationCallable = + callableFactory.createUnaryCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationSettings(), + clientContext); + this.exportRegistrationOperationCallable = + callableFactory.createOperationCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRegistrationCallable = + callableFactory.createUnaryCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationSettings(), + clientContext); + this.deleteRegistrationOperationCallable = + callableFactory.createOperationCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + retrieveAuthorizationCodeTransportSettings, + settings.retrieveAuthorizationCodeSettings(), + clientContext); + this.resetAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + resetAuthorizationCodeTransportSettings, + settings.resetAuthorizationCodeSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchDomainsMethodDescriptor); + methodDescriptors.add(retrieveRegisterParametersMethodDescriptor); + methodDescriptors.add(registerDomainMethodDescriptor); + methodDescriptors.add(retrieveTransferParametersMethodDescriptor); + methodDescriptors.add(transferDomainMethodDescriptor); + methodDescriptors.add(listRegistrationsMethodDescriptor); + methodDescriptors.add(getRegistrationMethodDescriptor); + methodDescriptors.add(updateRegistrationMethodDescriptor); + methodDescriptors.add(configureManagementSettingsMethodDescriptor); + methodDescriptors.add(configureDnsSettingsMethodDescriptor); + methodDescriptors.add(configureContactSettingsMethodDescriptor); + methodDescriptors.add(exportRegistrationMethodDescriptor); + methodDescriptors.add(deleteRegistrationMethodDescriptor); + methodDescriptors.add(retrieveAuthorizationCodeMethodDescriptor); + methodDescriptors.add(resetAuthorizationCodeMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable searchDomainsCallable() { + return searchDomainsCallable; + } + + @Override + public UnaryCallable + retrieveRegisterParametersCallable() { + return retrieveRegisterParametersCallable; + } + + @Override + public UnaryCallable registerDomainCallable() { + return registerDomainCallable; + } + + @Override + public OperationCallable + registerDomainOperationCallable() { + return registerDomainOperationCallable; + } + + @Override + public UnaryCallable + retrieveTransferParametersCallable() { + return retrieveTransferParametersCallable; + } + + @Override + public UnaryCallable transferDomainCallable() { + return transferDomainCallable; + } + + @Override + public OperationCallable + transferDomainOperationCallable() { + return transferDomainOperationCallable; + } + + @Override + public UnaryCallable + listRegistrationsCallable() { + return listRegistrationsCallable; + } + + @Override + public UnaryCallable + listRegistrationsPagedCallable() { + return listRegistrationsPagedCallable; + } + + @Override + public UnaryCallable getRegistrationCallable() { + return getRegistrationCallable; + } + + @Override + public UnaryCallable updateRegistrationCallable() { + return updateRegistrationCallable; + } + + @Override + public OperationCallable + updateRegistrationOperationCallable() { + return updateRegistrationOperationCallable; + } + + @Override + public UnaryCallable + configureManagementSettingsCallable() { + return configureManagementSettingsCallable; + } + + @Override + public OperationCallable + configureManagementSettingsOperationCallable() { + return configureManagementSettingsOperationCallable; + } + + @Override + public UnaryCallable configureDnsSettingsCallable() { + return configureDnsSettingsCallable; + } + + @Override + public OperationCallable + configureDnsSettingsOperationCallable() { + return configureDnsSettingsOperationCallable; + } + + @Override + public UnaryCallable + configureContactSettingsCallable() { + return configureContactSettingsCallable; + } + + @Override + public OperationCallable + configureContactSettingsOperationCallable() { + return configureContactSettingsOperationCallable; + } + + @Override + public UnaryCallable exportRegistrationCallable() { + return exportRegistrationCallable; + } + + @Override + public OperationCallable + exportRegistrationOperationCallable() { + return exportRegistrationOperationCallable; + } + + @Override + public UnaryCallable deleteRegistrationCallable() { + return deleteRegistrationCallable; + } + + @Override + public OperationCallable + deleteRegistrationOperationCallable() { + return deleteRegistrationOperationCallable; + } + + @Override + public UnaryCallable + retrieveAuthorizationCodeCallable() { + return retrieveAuthorizationCodeCallable; + } + + @Override + public UnaryCallable + resetAuthorizationCodeCallable() { + return resetAuthorizationCodeCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java index ed9a6d18af1a..5af5aff9a9cd 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.domains.v1alpha2.stub.DomainsStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.type.Money; @@ -104,6 +104,20 @@ * DomainsClient domainsClient = DomainsClient.create(domainsSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * DomainsSettings domainsSettings =
+ *     DomainsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DomainsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DomainsClient domainsClient = DomainsClient.create(domainsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -111,7 +125,8 @@ public class DomainsClient implements BackgroundResource { private final DomainsSettings settings; private final DomainsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DomainsClient with default settings. */ public static final DomainsClient create() throws IOException { @@ -141,13 +156,17 @@ public static final DomainsClient create(DomainsStub stub) { protected DomainsClient(DomainsSettings settings) throws IOException { this.settings = settings; this.stub = ((DomainsStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected DomainsClient(DomainsStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final DomainsSettings getSettings() { @@ -162,10 +181,18 @@ public DomainsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Searches for available domain names similar to the provided query. diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java index 1229fd77583f..f7ff28d3a079 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/DomainsSettings.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -229,11 +230,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DomainsStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return DomainsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DomainsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DomainsStubSettings.defaultTransportChannelProvider(); } @@ -243,11 +251,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DomainsStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -285,6 +299,11 @@ private static Builder createDefault() { return new Builder(DomainsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DomainsStubSettings.newHttpJsonBuilder()); + } + public DomainsStubSettings.Builder getStubSettingsBuilder() { return ((DomainsStubSettings.Builder) getStubSettings()); } diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java index 676a64cb6827..5465e5ab5a2d 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStub.java @@ -60,7 +60,11 @@ public abstract class DomainsStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable searchDomainsCallable() { diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java index 3e6227b62494..3ffa9c4856cd 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/DomainsStubSettings.java @@ -28,6 +28,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -361,6 +364,11 @@ public DomainsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDomainsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDomainsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -393,29 +401,54 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DomainsStubSettings.class)) .setTransportToken( GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DomainsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DomainsStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -659,6 +692,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .searchDomainsSettings() diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.java new file mode 100644 index 000000000000..4b9cb1996e76 --- /dev/null +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Domains service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java new file mode 100644 index 000000000000..7c7efb05e014 --- /dev/null +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1alpha2/stub/HttpJsonDomainsStub.java @@ -0,0 +1,1138 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.stub; + +import static com.google.cloud.domains.v1alpha2.DomainsClient.ListRegistrationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.GetRegistrationRequest; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.ListRegistrationsResponse; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.ResetAuthorizationCodeRequest; +import com.google.cloud.domains.v1alpha2.RetrieveAuthorizationCodeRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; +import com.google.cloud.domains.v1alpha2.SearchDomainsRequest; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Domains service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsStub extends DomainsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(Registration.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + searchDomainsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/SearchDomains") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{location=projects/*/locations/*}/registrations:searchDomains", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchDomainsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + RetrieveRegisterParametersRequest, RetrieveRegisterParametersResponse> + retrieveRegisterParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RetrieveRegisterParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{location=projects/*/locations/*}/registrations:retrieveRegisterParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveRegisterParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RegisterDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{parent=projects/*/locations/*}/registrations:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RegisterDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + RetrieveTransferParametersRequest, RetrieveTransferParametersResponse> + retrieveTransferParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RetrieveTransferParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{location=projects/*/locations/*}/registrations:retrieveTransferParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveTransferParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + transferDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/TransferDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{parent=projects/*/locations/*}/registrations:transfer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (TransferDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRegistrationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ListRegistrations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{parent=projects/*/locations/*}/registrations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRegistrationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/GetRegistration") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Registration.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/UpdateRegistration") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration.name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration.name", request.getRegistration().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("registration", request.getRegistration())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureManagementSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.domains.v1alpha2.Domains/ConfigureManagementSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:configureManagementSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureManagementSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureDnsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ConfigureDnsSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:configureDnsSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureDnsSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureContactSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ConfigureContactSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:configureContactSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureContactSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + exportRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ExportRegistration") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{name=projects/*/locations/*/registrations/*}:export", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/DeleteRegistration") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + retrieveAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/RetrieveAuthorizationCode") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:retrieveAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + resetAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1alpha2.Domains/ResetAuthorizationCode") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha2/{registration=projects/*/locations/*/registrations/*}:resetAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchDomainsCallable; + private final UnaryCallable + retrieveRegisterParametersCallable; + private final UnaryCallable registerDomainCallable; + private final OperationCallable + registerDomainOperationCallable; + private final UnaryCallable + retrieveTransferParametersCallable; + private final UnaryCallable transferDomainCallable; + private final OperationCallable + transferDomainOperationCallable; + private final UnaryCallable + listRegistrationsCallable; + private final UnaryCallable + listRegistrationsPagedCallable; + private final UnaryCallable getRegistrationCallable; + private final UnaryCallable updateRegistrationCallable; + private final OperationCallable + updateRegistrationOperationCallable; + private final UnaryCallable + configureManagementSettingsCallable; + private final OperationCallable< + ConfigureManagementSettingsRequest, Registration, OperationMetadata> + configureManagementSettingsOperationCallable; + private final UnaryCallable configureDnsSettingsCallable; + private final OperationCallable + configureDnsSettingsOperationCallable; + private final UnaryCallable + configureContactSettingsCallable; + private final OperationCallable + configureContactSettingsOperationCallable; + private final UnaryCallable exportRegistrationCallable; + private final OperationCallable + exportRegistrationOperationCallable; + private final UnaryCallable deleteRegistrationCallable; + private final OperationCallable + deleteRegistrationOperationCallable; + private final UnaryCallable + retrieveAuthorizationCodeCallable; + private final UnaryCallable + resetAuthorizationCodeCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDomainsStub create(DomainsStubSettings settings) throws IOException { + return new HttpJsonDomainsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDomainsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDomainsStub(DomainsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDomainsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDomainsStub( + DomainsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDomainsStub(DomainsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDomainsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDomainsStub( + DomainsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + searchDomainsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchDomainsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveRegisterParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveRegisterParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings registerDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveTransferParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveTransferParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings transferDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRegistrationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegistrationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureManagementSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureManagementSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureDnsSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureDnsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureContactSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureContactSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(retrieveAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + resetAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchDomainsCallable = + callableFactory.createUnaryCallable( + searchDomainsTransportSettings, settings.searchDomainsSettings(), clientContext); + this.retrieveRegisterParametersCallable = + callableFactory.createUnaryCallable( + retrieveRegisterParametersTransportSettings, + settings.retrieveRegisterParametersSettings(), + clientContext); + this.registerDomainCallable = + callableFactory.createUnaryCallable( + registerDomainTransportSettings, settings.registerDomainSettings(), clientContext); + this.registerDomainOperationCallable = + callableFactory.createOperationCallable( + registerDomainTransportSettings, + settings.registerDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveTransferParametersCallable = + callableFactory.createUnaryCallable( + retrieveTransferParametersTransportSettings, + settings.retrieveTransferParametersSettings(), + clientContext); + this.transferDomainCallable = + callableFactory.createUnaryCallable( + transferDomainTransportSettings, settings.transferDomainSettings(), clientContext); + this.transferDomainOperationCallable = + callableFactory.createOperationCallable( + transferDomainTransportSettings, + settings.transferDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRegistrationsCallable = + callableFactory.createUnaryCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.listRegistrationsPagedCallable = + callableFactory.createPagedCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.getRegistrationCallable = + callableFactory.createUnaryCallable( + getRegistrationTransportSettings, settings.getRegistrationSettings(), clientContext); + this.updateRegistrationCallable = + callableFactory.createUnaryCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationSettings(), + clientContext); + this.updateRegistrationOperationCallable = + callableFactory.createOperationCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureManagementSettingsCallable = + callableFactory.createUnaryCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsSettings(), + clientContext); + this.configureManagementSettingsOperationCallable = + callableFactory.createOperationCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureDnsSettingsCallable = + callableFactory.createUnaryCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsSettings(), + clientContext); + this.configureDnsSettingsOperationCallable = + callableFactory.createOperationCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureContactSettingsCallable = + callableFactory.createUnaryCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsSettings(), + clientContext); + this.configureContactSettingsOperationCallable = + callableFactory.createOperationCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.exportRegistrationCallable = + callableFactory.createUnaryCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationSettings(), + clientContext); + this.exportRegistrationOperationCallable = + callableFactory.createOperationCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRegistrationCallable = + callableFactory.createUnaryCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationSettings(), + clientContext); + this.deleteRegistrationOperationCallable = + callableFactory.createOperationCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + retrieveAuthorizationCodeTransportSettings, + settings.retrieveAuthorizationCodeSettings(), + clientContext); + this.resetAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + resetAuthorizationCodeTransportSettings, + settings.resetAuthorizationCodeSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchDomainsMethodDescriptor); + methodDescriptors.add(retrieveRegisterParametersMethodDescriptor); + methodDescriptors.add(registerDomainMethodDescriptor); + methodDescriptors.add(retrieveTransferParametersMethodDescriptor); + methodDescriptors.add(transferDomainMethodDescriptor); + methodDescriptors.add(listRegistrationsMethodDescriptor); + methodDescriptors.add(getRegistrationMethodDescriptor); + methodDescriptors.add(updateRegistrationMethodDescriptor); + methodDescriptors.add(configureManagementSettingsMethodDescriptor); + methodDescriptors.add(configureDnsSettingsMethodDescriptor); + methodDescriptors.add(configureContactSettingsMethodDescriptor); + methodDescriptors.add(exportRegistrationMethodDescriptor); + methodDescriptors.add(deleteRegistrationMethodDescriptor); + methodDescriptors.add(retrieveAuthorizationCodeMethodDescriptor); + methodDescriptors.add(resetAuthorizationCodeMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable searchDomainsCallable() { + return searchDomainsCallable; + } + + @Override + public UnaryCallable + retrieveRegisterParametersCallable() { + return retrieveRegisterParametersCallable; + } + + @Override + public UnaryCallable registerDomainCallable() { + return registerDomainCallable; + } + + @Override + public OperationCallable + registerDomainOperationCallable() { + return registerDomainOperationCallable; + } + + @Override + public UnaryCallable + retrieveTransferParametersCallable() { + return retrieveTransferParametersCallable; + } + + @Override + public UnaryCallable transferDomainCallable() { + return transferDomainCallable; + } + + @Override + public OperationCallable + transferDomainOperationCallable() { + return transferDomainOperationCallable; + } + + @Override + public UnaryCallable + listRegistrationsCallable() { + return listRegistrationsCallable; + } + + @Override + public UnaryCallable + listRegistrationsPagedCallable() { + return listRegistrationsPagedCallable; + } + + @Override + public UnaryCallable getRegistrationCallable() { + return getRegistrationCallable; + } + + @Override + public UnaryCallable updateRegistrationCallable() { + return updateRegistrationCallable; + } + + @Override + public OperationCallable + updateRegistrationOperationCallable() { + return updateRegistrationOperationCallable; + } + + @Override + public UnaryCallable + configureManagementSettingsCallable() { + return configureManagementSettingsCallable; + } + + @Override + public OperationCallable + configureManagementSettingsOperationCallable() { + return configureManagementSettingsOperationCallable; + } + + @Override + public UnaryCallable configureDnsSettingsCallable() { + return configureDnsSettingsCallable; + } + + @Override + public OperationCallable + configureDnsSettingsOperationCallable() { + return configureDnsSettingsOperationCallable; + } + + @Override + public UnaryCallable + configureContactSettingsCallable() { + return configureContactSettingsCallable; + } + + @Override + public OperationCallable + configureContactSettingsOperationCallable() { + return configureContactSettingsOperationCallable; + } + + @Override + public UnaryCallable exportRegistrationCallable() { + return exportRegistrationCallable; + } + + @Override + public OperationCallable + exportRegistrationOperationCallable() { + return exportRegistrationOperationCallable; + } + + @Override + public UnaryCallable deleteRegistrationCallable() { + return deleteRegistrationCallable; + } + + @Override + public OperationCallable + deleteRegistrationOperationCallable() { + return deleteRegistrationOperationCallable; + } + + @Override + public UnaryCallable + retrieveAuthorizationCodeCallable() { + return retrieveAuthorizationCodeCallable; + } + + @Override + public UnaryCallable + resetAuthorizationCodeCallable() { + return resetAuthorizationCodeCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java index dab301590edd..a0c5bc2c5112 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.domains.v1beta1.stub.DomainsStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.type.Money; @@ -104,6 +104,20 @@ * DomainsClient domainsClient = DomainsClient.create(domainsSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * DomainsSettings domainsSettings =
+ *     DomainsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             DomainsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * DomainsClient domainsClient = DomainsClient.create(domainsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -111,7 +125,8 @@ public class DomainsClient implements BackgroundResource { private final DomainsSettings settings; private final DomainsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DomainsClient with default settings. */ public static final DomainsClient create() throws IOException { @@ -141,13 +156,17 @@ public static final DomainsClient create(DomainsStub stub) { protected DomainsClient(DomainsSettings settings) throws IOException { this.settings = settings; this.stub = ((DomainsStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected DomainsClient(DomainsStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final DomainsSettings getSettings() { @@ -162,10 +181,18 @@ public DomainsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Searches for available domain names similar to the provided query. diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java index 4629a5867d77..a3e4dad65094 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/DomainsSettings.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -229,11 +230,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return DomainsStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return DomainsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DomainsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return DomainsStubSettings.defaultTransportChannelProvider(); } @@ -243,11 +251,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return DomainsStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -285,6 +299,11 @@ private static Builder createDefault() { return new Builder(DomainsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DomainsStubSettings.newHttpJsonBuilder()); + } + public DomainsStubSettings.Builder getStubSettingsBuilder() { return ((DomainsStubSettings.Builder) getStubSettings()); } diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java index 1493625f3145..fccd3612a34d 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStub.java @@ -60,7 +60,11 @@ public abstract class DomainsStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable searchDomainsCallable() { diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java index b0257628577c..46d9bb333d7f 100644 --- a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/DomainsStubSettings.java @@ -28,6 +28,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -361,6 +364,11 @@ public DomainsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcDomainsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDomainsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -393,29 +401,54 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DomainsStubSettings.class)) .setTransportToken( GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(DomainsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DomainsStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -659,6 +692,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .searchDomainsSettings() diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.java new file mode 100644 index 000000000000..e6ae40465263 --- /dev/null +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Domains service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java new file mode 100644 index 000000000000..4f68aa9595df --- /dev/null +++ b/java-domains/google-cloud-domains/src/main/java/com/google/cloud/domains/v1beta1/stub/HttpJsonDomainsStub.java @@ -0,0 +1,1137 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.stub; + +import static com.google.cloud.domains.v1beta1.DomainsClient.ListRegistrationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.GetRegistrationRequest; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.ListRegistrationsResponse; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.ResetAuthorizationCodeRequest; +import com.google.cloud.domains.v1beta1.RetrieveAuthorizationCodeRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; +import com.google.cloud.domains.v1beta1.SearchDomainsRequest; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Domains service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonDomainsStub extends DomainsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(Registration.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + searchDomainsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/SearchDomains") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{location=projects/*/locations/*}/registrations:searchDomains", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchDomainsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + RetrieveRegisterParametersRequest, RetrieveRegisterParametersResponse> + retrieveRegisterParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RetrieveRegisterParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{location=projects/*/locations/*}/registrations:retrieveRegisterParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveRegisterParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RegisterDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/registrations:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RegisterDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + RetrieveTransferParametersRequest, RetrieveTransferParametersResponse> + retrieveTransferParametersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RetrieveTransferParameters") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{location=projects/*/locations/*}/registrations:retrieveTransferParameters", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "domainName", request.getDomainName()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RetrieveTransferParametersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + transferDomainMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/TransferDomain") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/registrations:transfer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (TransferDomainRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRegistrationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ListRegistrations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/registrations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRegistrationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/GetRegistration") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Registration.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/UpdateRegistration") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration.name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration.name", request.getRegistration().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("registration", request.getRegistration())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureManagementSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ConfigureManagementSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:configureManagementSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureManagementSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureDnsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ConfigureDnsSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:configureDnsSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureDnsSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + configureContactSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ConfigureContactSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:configureContactSettings", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ConfigureContactSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + exportRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ExportRegistration") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/registrations/*}:export", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRegistrationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/DeleteRegistration") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/registrations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteRegistrationRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + retrieveAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/RetrieveAuthorizationCode") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:retrieveAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + resetAuthorizationCodeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.domains.v1beta1.Domains/ResetAuthorizationCode") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{registration=projects/*/locations/*/registrations/*}:resetAuthorizationCode", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "registration", request.getRegistration()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearRegistration().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuthorizationCode.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchDomainsCallable; + private final UnaryCallable + retrieveRegisterParametersCallable; + private final UnaryCallable registerDomainCallable; + private final OperationCallable + registerDomainOperationCallable; + private final UnaryCallable + retrieveTransferParametersCallable; + private final UnaryCallable transferDomainCallable; + private final OperationCallable + transferDomainOperationCallable; + private final UnaryCallable + listRegistrationsCallable; + private final UnaryCallable + listRegistrationsPagedCallable; + private final UnaryCallable getRegistrationCallable; + private final UnaryCallable updateRegistrationCallable; + private final OperationCallable + updateRegistrationOperationCallable; + private final UnaryCallable + configureManagementSettingsCallable; + private final OperationCallable< + ConfigureManagementSettingsRequest, Registration, OperationMetadata> + configureManagementSettingsOperationCallable; + private final UnaryCallable configureDnsSettingsCallable; + private final OperationCallable + configureDnsSettingsOperationCallable; + private final UnaryCallable + configureContactSettingsCallable; + private final OperationCallable + configureContactSettingsOperationCallable; + private final UnaryCallable exportRegistrationCallable; + private final OperationCallable + exportRegistrationOperationCallable; + private final UnaryCallable deleteRegistrationCallable; + private final OperationCallable + deleteRegistrationOperationCallable; + private final UnaryCallable + retrieveAuthorizationCodeCallable; + private final UnaryCallable + resetAuthorizationCodeCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDomainsStub create(DomainsStubSettings settings) throws IOException { + return new HttpJsonDomainsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDomainsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonDomainsStub(DomainsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDomainsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDomainsStub( + DomainsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDomainsStub(DomainsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonDomainsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDomainsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonDomainsStub( + DomainsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + searchDomainsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchDomainsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveRegisterParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveRegisterParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings registerDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveTransferParametersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(retrieveTransferParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings transferDomainTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferDomainMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRegistrationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRegistrationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureManagementSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureManagementSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureDnsSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureDnsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + configureContactSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(configureContactSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRegistrationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRegistrationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + retrieveAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(retrieveAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + resetAuthorizationCodeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(resetAuthorizationCodeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchDomainsCallable = + callableFactory.createUnaryCallable( + searchDomainsTransportSettings, settings.searchDomainsSettings(), clientContext); + this.retrieveRegisterParametersCallable = + callableFactory.createUnaryCallable( + retrieveRegisterParametersTransportSettings, + settings.retrieveRegisterParametersSettings(), + clientContext); + this.registerDomainCallable = + callableFactory.createUnaryCallable( + registerDomainTransportSettings, settings.registerDomainSettings(), clientContext); + this.registerDomainOperationCallable = + callableFactory.createOperationCallable( + registerDomainTransportSettings, + settings.registerDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveTransferParametersCallable = + callableFactory.createUnaryCallable( + retrieveTransferParametersTransportSettings, + settings.retrieveTransferParametersSettings(), + clientContext); + this.transferDomainCallable = + callableFactory.createUnaryCallable( + transferDomainTransportSettings, settings.transferDomainSettings(), clientContext); + this.transferDomainOperationCallable = + callableFactory.createOperationCallable( + transferDomainTransportSettings, + settings.transferDomainOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRegistrationsCallable = + callableFactory.createUnaryCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.listRegistrationsPagedCallable = + callableFactory.createPagedCallable( + listRegistrationsTransportSettings, + settings.listRegistrationsSettings(), + clientContext); + this.getRegistrationCallable = + callableFactory.createUnaryCallable( + getRegistrationTransportSettings, settings.getRegistrationSettings(), clientContext); + this.updateRegistrationCallable = + callableFactory.createUnaryCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationSettings(), + clientContext); + this.updateRegistrationOperationCallable = + callableFactory.createOperationCallable( + updateRegistrationTransportSettings, + settings.updateRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureManagementSettingsCallable = + callableFactory.createUnaryCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsSettings(), + clientContext); + this.configureManagementSettingsOperationCallable = + callableFactory.createOperationCallable( + configureManagementSettingsTransportSettings, + settings.configureManagementSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureDnsSettingsCallable = + callableFactory.createUnaryCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsSettings(), + clientContext); + this.configureDnsSettingsOperationCallable = + callableFactory.createOperationCallable( + configureDnsSettingsTransportSettings, + settings.configureDnsSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.configureContactSettingsCallable = + callableFactory.createUnaryCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsSettings(), + clientContext); + this.configureContactSettingsOperationCallable = + callableFactory.createOperationCallable( + configureContactSettingsTransportSettings, + settings.configureContactSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.exportRegistrationCallable = + callableFactory.createUnaryCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationSettings(), + clientContext); + this.exportRegistrationOperationCallable = + callableFactory.createOperationCallable( + exportRegistrationTransportSettings, + settings.exportRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRegistrationCallable = + callableFactory.createUnaryCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationSettings(), + clientContext); + this.deleteRegistrationOperationCallable = + callableFactory.createOperationCallable( + deleteRegistrationTransportSettings, + settings.deleteRegistrationOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.retrieveAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + retrieveAuthorizationCodeTransportSettings, + settings.retrieveAuthorizationCodeSettings(), + clientContext); + this.resetAuthorizationCodeCallable = + callableFactory.createUnaryCallable( + resetAuthorizationCodeTransportSettings, + settings.resetAuthorizationCodeSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchDomainsMethodDescriptor); + methodDescriptors.add(retrieveRegisterParametersMethodDescriptor); + methodDescriptors.add(registerDomainMethodDescriptor); + methodDescriptors.add(retrieveTransferParametersMethodDescriptor); + methodDescriptors.add(transferDomainMethodDescriptor); + methodDescriptors.add(listRegistrationsMethodDescriptor); + methodDescriptors.add(getRegistrationMethodDescriptor); + methodDescriptors.add(updateRegistrationMethodDescriptor); + methodDescriptors.add(configureManagementSettingsMethodDescriptor); + methodDescriptors.add(configureDnsSettingsMethodDescriptor); + methodDescriptors.add(configureContactSettingsMethodDescriptor); + methodDescriptors.add(exportRegistrationMethodDescriptor); + methodDescriptors.add(deleteRegistrationMethodDescriptor); + methodDescriptors.add(retrieveAuthorizationCodeMethodDescriptor); + methodDescriptors.add(resetAuthorizationCodeMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable searchDomainsCallable() { + return searchDomainsCallable; + } + + @Override + public UnaryCallable + retrieveRegisterParametersCallable() { + return retrieveRegisterParametersCallable; + } + + @Override + public UnaryCallable registerDomainCallable() { + return registerDomainCallable; + } + + @Override + public OperationCallable + registerDomainOperationCallable() { + return registerDomainOperationCallable; + } + + @Override + public UnaryCallable + retrieveTransferParametersCallable() { + return retrieveTransferParametersCallable; + } + + @Override + public UnaryCallable transferDomainCallable() { + return transferDomainCallable; + } + + @Override + public OperationCallable + transferDomainOperationCallable() { + return transferDomainOperationCallable; + } + + @Override + public UnaryCallable + listRegistrationsCallable() { + return listRegistrationsCallable; + } + + @Override + public UnaryCallable + listRegistrationsPagedCallable() { + return listRegistrationsPagedCallable; + } + + @Override + public UnaryCallable getRegistrationCallable() { + return getRegistrationCallable; + } + + @Override + public UnaryCallable updateRegistrationCallable() { + return updateRegistrationCallable; + } + + @Override + public OperationCallable + updateRegistrationOperationCallable() { + return updateRegistrationOperationCallable; + } + + @Override + public UnaryCallable + configureManagementSettingsCallable() { + return configureManagementSettingsCallable; + } + + @Override + public OperationCallable + configureManagementSettingsOperationCallable() { + return configureManagementSettingsOperationCallable; + } + + @Override + public UnaryCallable configureDnsSettingsCallable() { + return configureDnsSettingsCallable; + } + + @Override + public OperationCallable + configureDnsSettingsOperationCallable() { + return configureDnsSettingsOperationCallable; + } + + @Override + public UnaryCallable + configureContactSettingsCallable() { + return configureContactSettingsCallable; + } + + @Override + public OperationCallable + configureContactSettingsOperationCallable() { + return configureContactSettingsOperationCallable; + } + + @Override + public UnaryCallable exportRegistrationCallable() { + return exportRegistrationCallable; + } + + @Override + public OperationCallable + exportRegistrationOperationCallable() { + return exportRegistrationOperationCallable; + } + + @Override + public UnaryCallable deleteRegistrationCallable() { + return deleteRegistrationCallable; + } + + @Override + public OperationCallable + deleteRegistrationOperationCallable() { + return deleteRegistrationOperationCallable; + } + + @Override + public UnaryCallable + retrieveAuthorizationCodeCallable() { + return retrieveAuthorizationCodeCallable; + } + + @Override + public UnaryCallable + resetAuthorizationCodeCallable() { + return resetAuthorizationCodeCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java b/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java new file mode 100644 index 000000000000..9ffed06dcb58 --- /dev/null +++ b/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1/DomainsClientHttpJsonTest.java @@ -0,0 +1,1700 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1; + +import static com.google.cloud.domains.v1.DomainsClient.ListRegistrationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.domains.v1.stub.HttpJsonDomainsStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import com.google.type.Money; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DomainsClientHttpJsonTest { + private static MockHttpService mockService; + private static DomainsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDomainsStub.getMethodDescriptors(), DomainsSettings.getDefaultEndpoint()); + DomainsSettings settings = + DomainsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DomainsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchDomainsTest() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchDomainsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchDomainsTest2() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchDomainsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveRegisterParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest2() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveRegisterParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDomainExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void registerDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDomainExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveTransferParametersTest() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveTransferParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveTransferParametersTest2() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveTransferParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void transferDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void transferDomainExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void transferDomainExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRegistrationsTest() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRegistrationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRegistrationsTest2() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRegistrationsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.getRegistration(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.getRegistration(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = client.updateRegistrationAsync(registration, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRegistrationAsync(registration, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureManagementSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureManagementSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureDnsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureDnsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureContactSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureContactSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.exportRegistrationAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.exportRegistrationAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + client.deleteRegistrationAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + client.deleteRegistrationAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void resetAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void resetAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java b/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java new file mode 100644 index 000000000000..82aa94426558 --- /dev/null +++ b/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1alpha2/DomainsClientHttpJsonTest.java @@ -0,0 +1,1700 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2; + +import static com.google.cloud.domains.v1alpha2.DomainsClient.ListRegistrationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.domains.v1alpha2.stub.HttpJsonDomainsStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import com.google.type.Money; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DomainsClientHttpJsonTest { + private static MockHttpService mockService; + private static DomainsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDomainsStub.getMethodDescriptors(), DomainsSettings.getDefaultEndpoint()); + DomainsSettings settings = + DomainsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DomainsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchDomainsTest() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchDomainsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchDomainsTest2() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchDomainsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveRegisterParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest2() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveRegisterParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDomainExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void registerDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDomainExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveTransferParametersTest() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveTransferParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveTransferParametersTest2() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveTransferParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void transferDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void transferDomainExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void transferDomainExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRegistrationsTest() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRegistrationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRegistrationsTest2() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRegistrationsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.getRegistration(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.getRegistration(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = client.updateRegistrationAsync(registration, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRegistrationAsync(registration, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureManagementSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureManagementSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureDnsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureDnsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureContactSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureContactSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.exportRegistrationAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.exportRegistrationAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + client.deleteRegistrationAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + client.deleteRegistrationAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void resetAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void resetAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java b/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java new file mode 100644 index 000000000000..d8fc771fd16f --- /dev/null +++ b/java-domains/google-cloud-domains/src/test/java/com/google/cloud/domains/v1beta1/DomainsClientHttpJsonTest.java @@ -0,0 +1,1700 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1; + +import static com.google.cloud.domains.v1beta1.DomainsClient.ListRegistrationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.domains.v1beta1.stub.HttpJsonDomainsStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import com.google.type.Money; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DomainsClientHttpJsonTest { + private static MockHttpService mockService; + private static DomainsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDomainsStub.getMethodDescriptors(), DomainsSettings.getDefaultEndpoint()); + DomainsSettings settings = + DomainsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DomainsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchDomainsTest() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchDomainsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchDomainsTest2() throws Exception { + SearchDomainsResponse expectedResponse = + SearchDomainsResponse.newBuilder() + .addAllRegisterParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + + SearchDomainsResponse actualResponse = client.searchDomains(location, query); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchDomainsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String query = "query107944136"; + client.searchDomains(location, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveRegisterParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveRegisterParametersTest2() throws Exception { + RetrieveRegisterParametersResponse expectedResponse = + RetrieveRegisterParametersResponse.newBuilder() + .setRegisterParameters(RegisterParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveRegisterParametersResponse actualResponse = + client.retrieveRegisterParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveRegisterParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveRegisterParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDomainExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void registerDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("registerDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + + Registration actualResponse = + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void registerDomainExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + client.registerDomainAsync(parent, registration, yearlyPrice).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveTransferParametersTest() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveTransferParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveTransferParametersTest2() throws Exception { + RetrieveTransferParametersResponse expectedResponse = + RetrieveTransferParametersResponse.newBuilder() + .setTransferParameters(TransferParameters.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + + RetrieveTransferParametersResponse actualResponse = + client.retrieveTransferParameters(location, domainName); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveTransferParametersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + String domainName = "domainName-1244085905"; + client.retrieveTransferParameters(location, domainName); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void transferDomainTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void transferDomainExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferDomainTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferDomainTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + + Registration actualResponse = + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void transferDomainExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + client.transferDomainAsync(parent, registration, yearlyPrice, authorizationCode).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRegistrationsTest() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRegistrationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRegistrationsTest2() throws Exception { + Registration responsesElement = Registration.newBuilder().build(); + ListRegistrationsResponse expectedResponse = + ListRegistrationsResponse.newBuilder() + .setNextPageToken("") + .addAllRegistrations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRegistrationsPagedResponse pagedListResponse = client.listRegistrations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRegistrationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRegistrationsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listRegistrations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.getRegistration(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.getRegistration(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.getRegistration(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = client.updateRegistrationAsync(registration, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Registration registration = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRegistrationAsync(registration, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureManagementSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureManagementSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureManagementSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureManagementSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureManagementSettingsAsync(registration, managementSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureDnsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureDnsSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureDnsSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureDnsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureContactSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void configureContactSettingsTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("configureContactSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Registration actualResponse = + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void configureContactSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.configureContactSettingsAsync(registration, contactSettings, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + Registration actualResponse = client.exportRegistrationAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportRegistrationTest2() throws Exception { + Registration expectedResponse = + Registration.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDomainName("domainName-1244085905") + .setCreateTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .addAllIssues(new ArrayList()) + .putAllLabels(new HashMap()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setPendingContactSettings(ContactSettings.newBuilder().build()) + .addAllSupportedPrivacy(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + Registration actualResponse = client.exportRegistrationAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.exportRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + client.deleteRegistrationAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRegistrationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRegistrationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRegistrationTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + + client.deleteRegistrationAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRegistrationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3120/locations/location-3120/registrations/registration-3120"; + client.deleteRegistrationAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void retrieveAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void retrieveAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.retrieveAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void retrieveAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.retrieveAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void resetAuthorizationCodeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resetAuthorizationCodeTest2() throws Exception { + AuthorizationCode expectedResponse = + AuthorizationCode.newBuilder().setCode("code3059181").build(); + mockService.addResponse(expectedResponse); + + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + + AuthorizationCode actualResponse = client.resetAuthorizationCode(registration); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void resetAuthorizationCodeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String registration = + "projects/project-4210/locations/location-4210/registrations/registration-4210"; + client.resetAuthorizationCode(registration); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java new file mode 100644 index 000000000000..fbb716585e82 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurecontactsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettings(); + } + + public static void asyncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureContactSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurecontactsettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java new file mode 100644 index 000000000000..df0b46d78450 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurecontactsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettingsLRO(); + } + + public static void asyncConfigureContactSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureContactSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurecontactsettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java new file mode 100644 index 000000000000..62ef79d7722b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurecontactsettings_sync] +import com.google.cloud.domains.v1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettings(); + } + + public static void syncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureContactSettingsAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurecontactsettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java new file mode 100644 index 000000000000..c7faf3fc180b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java new file mode 100644 index 000000000000..7a70741dcbe1 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1.ContactSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsStringContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsStringContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsStringContactsettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java new file mode 100644 index 000000000000..6a3d4a325c2a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettings(); + } + + public static void asyncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureDnsSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java new file mode 100644 index 000000000000..9c50e609b8c8 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettingsLRO(); + } + + public static void asyncConfigureDnsSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureDnsSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java new file mode 100644 index 000000000000..088c97797301 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_sync] +import com.google.cloud.domains.v1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettings(); + } + + public static void syncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureDnsSettingsAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java new file mode 100644 index 000000000000..164cb4b0eb17 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java new file mode 100644 index 000000000000..ca8de3d9be56 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] +import com.google.cloud.domains.v1.DnsSettings; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsStringDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsStringDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsStringDnssettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java new file mode 100644 index 000000000000..df7cd70717ac --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configuremanagementsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettings(); + } + + public static void asyncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + domainsClient.configureManagementSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configuremanagementsettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java new file mode 100644 index 000000000000..375314354b71 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configuremanagementsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettingsLRO(); + } + + public static void asyncConfigureManagementSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.configureManagementSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_configuremanagementsettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java new file mode 100644 index 000000000000..d0196dd050b7 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_configuremanagementsettings_sync] +import com.google.cloud.domains.v1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettings(); + } + + public static void syncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.configureManagementSettingsAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_configuremanagementsettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java new file mode 100644 index 000000000000..cdea50c135ba --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java new file mode 100644 index 000000000000..fa2d5df095d0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ManagementSettings; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsStringManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsStringManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsStringManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..25839dd48416 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.DomainsSettings; +import com.google.cloud.domains.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1_generated_domainsclient_create_setcredentialsprovider_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..ab5e5974a426 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.DomainsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1_generated_domainsclient_create_setcredentialsprovider1_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..8f0ed94445c3 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_create_setendpoint_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.DomainsSettings; +import com.google.cloud.domains.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = DomainsSettings.newBuilder().setEndpoint(myEndpoint).build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1_generated_domainsclient_create_setendpoint_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.java new file mode 100644 index 000000000000..38fd8e2ef6f1 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistration(); + } + + public static void asyncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.deleteRegistrationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java new file mode 100644 index 000000000000..e23af4cf92cc --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistrationLRO(); + } + + public static void asyncDeleteRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.deleteRegistrationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.java new file mode 100644 index 000000000000..4b4f31d6224f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistration.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_sync] +import com.google.cloud.domains.v1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + syncDeleteRegistration(); + } + + public static void syncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + domainsClient.deleteRegistrationAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java new file mode 100644 index 000000000000..030082ee65cf --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_registrationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncDeleteRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationRegistrationname(); + } + + public static void syncDeleteRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java new file mode 100644 index 000000000000..a7024f1b6c99 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_deleteregistration_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncDeleteRegistrationString { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationString(); + } + + public static void syncDeleteRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_deleteregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.java new file mode 100644 index 000000000000..3f46f2e299f4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncExportRegistration { + + public static void main(String[] args) throws Exception { + asyncExportRegistration(); + } + + public static void asyncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.exportRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java new file mode 100644 index 000000000000..8d026fb5d042 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class AsyncExportRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncExportRegistrationLRO(); + } + + public static void asyncExportRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.exportRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.java new file mode 100644 index 000000000000..56feaeec3ead --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ExportRegistrationRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncExportRegistration { + + public static void main(String[] args) throws Exception { + syncExportRegistration(); + } + + public static void syncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.exportRegistrationAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java new file mode 100644 index 000000000000..8d2f1fa28497 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_registrationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncExportRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncExportRegistrationRegistrationname(); + } + + public static void syncExportRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.java new file mode 100644 index 000000000000..26c1b6d1ffca --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/exportregistration/SyncExportRegistrationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_exportregistration_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncExportRegistrationString { + + public static void main(String[] args) throws Exception { + syncExportRegistrationString(); + } + + public static void syncExportRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1_generated_domainsclient_exportregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.java new file mode 100644 index 000000000000..03f07c1575fa --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/AsyncGetRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.GetRegistrationRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class AsyncGetRegistration { + + public static void main(String[] args) throws Exception { + asyncGetRegistration(); + } + + public static void asyncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.getRegistrationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.java new file mode 100644 index 000000000000..338ac9db5ca8 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.GetRegistrationRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncGetRegistration { + + public static void main(String[] args) throws Exception { + syncGetRegistration(); + } + + public static void syncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.getRegistration(request); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java new file mode 100644 index 000000000000..6def43de7c35 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_registrationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncGetRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncGetRegistrationRegistrationname(); + } + + public static void syncGetRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.java new file mode 100644 index 000000000000..827e9d977383 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/getregistration/SyncGetRegistrationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_getregistration_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncGetRegistrationString { + + public static void main(String[] args) throws Exception { + syncGetRegistrationString(); + } + + public static void syncGetRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1_generated_domainsclient_getregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java new file mode 100644 index 000000000000..779866917e57 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class AsyncListRegistrations { + + public static void main(String[] args) throws Exception { + asyncListRegistrations(); + } + + public static void asyncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + domainsClient.listRegistrationsPagedCallable().futureCall(request); + // Do something. + for (Registration element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java new file mode 100644 index 000000000000..31ac7fa17e6b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_paged_async] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.ListRegistrationsResponse; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.common.base.Strings; + +public class AsyncListRegistrationsPaged { + + public static void main(String[] args) throws Exception { + asyncListRegistrationsPaged(); + } + + public static void asyncListRegistrationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListRegistrationsResponse response = + domainsClient.listRegistrationsCallable().call(request); + for (Registration element : response.getRegistrationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_paged_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.java new file mode 100644 index 000000000000..59c217c90e93 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrations.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.ListRegistrationsRequest; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class SyncListRegistrations { + + public static void main(String[] args) throws Exception { + syncListRegistrations(); + } + + public static void syncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Registration element : domainsClient.listRegistrations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java new file mode 100644 index 000000000000..218f17881cee --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_locationname_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class SyncListRegistrationsLocationname { + + public static void main(String[] args) throws Exception { + syncListRegistrationsLocationname(); + } + + public static void syncListRegistrationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_locationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.java new file mode 100644 index 000000000000..26f1165dc270 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/listregistrations/SyncListRegistrationsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_listregistrations_string_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; + +public class SyncListRegistrationsString { + + public static void main(String[] args) throws Exception { + syncListRegistrationsString(); + } + + public static void syncListRegistrationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1_generated_domainsclient_listregistrations_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java new file mode 100644 index 000000000000..8babc11c34ef --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomain { + + public static void main(String[] args) throws Exception { + asyncRegisterDomain(); + } + + public static void asyncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.registerDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java new file mode 100644 index 000000000000..975a6035e5e3 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomainLRO { + + public static void main(String[] args) throws Exception { + asyncRegisterDomainLRO(); + } + + public static void asyncRegisterDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.registerDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java new file mode 100644 index 000000000000..b5235ccd8b0f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_sync] +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RegisterDomainRequest; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncRegisterDomain { + + public static void main(String[] args) throws Exception { + syncRegisterDomain(); + } + + public static void syncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.registerDomainAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java new file mode 100644 index 000000000000..7fd9c770e429 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainLocationnameRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainLocationnameRegistrationMoney(); + } + + public static void syncRegisterDomainLocationnameRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java new file mode 100644 index 000000000000..2e6020c57dad --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainStringRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainStringRegistrationMoney(); + } + + public static void syncRegisterDomainStringRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java new file mode 100644 index 000000000000..14bb3c7a5960 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.ResetAuthorizationCodeRequest; + +public class AsyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncResetAuthorizationCode(); + } + + public static void asyncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.resetAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java new file mode 100644 index 000000000000..7036976adab3 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.ResetAuthorizationCodeRequest; + +public class SyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCode(); + } + + public static void syncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(request); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java new file mode 100644 index 000000000000..160146cd3566 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncResetAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeRegistrationname(); + } + + public static void syncResetAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java new file mode 100644 index 000000000000..d00cd1af445a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_resetauthorizationcode_string_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncResetAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeString(); + } + + public static void syncResetAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_resetauthorizationcode_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java new file mode 100644 index 000000000000..8ce56cedabe0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.RetrieveAuthorizationCodeRequest; + +public class AsyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncRetrieveAuthorizationCode(); + } + + public static void asyncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java new file mode 100644 index 000000000000..5a36970de134 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; +import com.google.cloud.domains.v1.RetrieveAuthorizationCodeRequest; + +public class SyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCode(); + } + + public static void syncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(request); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java new file mode 100644 index 000000000000..baa896ad28b9 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeRegistrationname(); + } + + public static void syncRetrieveAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java new file mode 100644 index 000000000000..b6529c76ed14 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveauthorizationcode_string_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeString(); + } + + public static void syncRetrieveAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveauthorizationcode_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java new file mode 100644 index 000000000000..ec70b256801a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class AsyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveRegisterParameters(); + } + + public static void asyncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveRegisterParametersCallable().futureCall(request); + // Do something. + RetrieveRegisterParametersResponse response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java new file mode 100644 index 000000000000..9781489583ad --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParameters(); + } + + public static void syncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(request); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java new file mode 100644 index 000000000000..6bf60ed1b932 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersLocationnameString(); + } + + public static void syncRetrieveRegisterParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java new file mode 100644 index 000000000000..a152f438f59e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersStringString(); + } + + public static void syncRetrieveRegisterParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java new file mode 100644 index 000000000000..01b3087a3214 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class AsyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveTransferParameters(); + } + + public static void asyncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveTransferParametersCallable().futureCall(request); + // Do something. + RetrieveTransferParametersResponse response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java new file mode 100644 index 000000000000..ae357a288427 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParameters(); + } + + public static void syncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(request); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java new file mode 100644 index 000000000000..f190f1752ad4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersLocationnameString(); + } + + public static void syncRetrieveTransferParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java new file mode 100644 index 000000000000..8d647c32a2cb --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_retrievetransferparameters_stringstring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersStringString(); + } + + public static void syncRetrieveTransferParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1_generated_domainsclient_retrievetransferparameters_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.java new file mode 100644 index 000000000000..be6ae0361049 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/AsyncSearchDomains.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsRequest; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class AsyncSearchDomains { + + public static void main(String[] args) throws Exception { + asyncSearchDomains(); + } + + public static void asyncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.searchDomainsCallable().futureCall(request); + // Do something. + SearchDomainsResponse response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..83cf4965e255 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomains.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsRequest; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + SearchDomainsResponse response = domainsClient.searchDomains(request); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java new file mode 100644 index 000000000000..3a2cbe10e3c4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_locationnamestring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class SyncSearchDomainsLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsLocationnameString(); + } + + public static void syncSearchDomainsLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.java new file mode 100644 index 000000000000..d8daab9c0c65 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/searchdomains/SyncSearchDomainsStringString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_searchdomains_stringstring_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.SearchDomainsResponse; + +public class SyncSearchDomainsStringString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsStringString(); + } + + public static void syncSearchDomainsStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1_generated_domainsclient_searchdomains_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java new file mode 100644 index 000000000000..89a54979370d --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_transferdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomain { + + public static void main(String[] args) throws Exception { + asyncTransferDomain(); + } + + public static void asyncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.transferDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_transferdomain_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java new file mode 100644 index 000000000000..205ba321eeef --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/AsyncTransferDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_transferdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomainLRO { + + public static void main(String[] args) throws Exception { + asyncTransferDomainLRO(); + } + + public static void asyncTransferDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.transferDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_transferdomain_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java new file mode 100644 index 000000000000..4895e7607f87 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_transferdomain_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.ContactNotice; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncTransferDomain { + + public static void main(String[] args) throws Exception { + syncTransferDomain(); + } + + public static void syncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.transferDomainAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_transferdomain_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java new file mode 100644 index 000000000000..d96b4b9695b1 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java new file mode 100644 index 000000000000..37a6bc883d0b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START +// domains_v1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1.AuthorizationCode; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.LocationName; +import com.google.cloud.domains.v1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainStringRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainStringRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainStringRegistrationMoneyAuthorizationcode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.java new file mode 100644 index 000000000000..d6c189df7218 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistration.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistration(); + } + + public static void asyncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = domainsClient.updateRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java new file mode 100644 index 000000000000..3beaaaaf6ace --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.OperationMetadata; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistrationLRO(); + } + + public static void asyncUpdateRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.updateRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.java new file mode 100644 index 000000000000..27ef1a0268f4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistration.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.cloud.domains.v1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + syncUpdateRegistration(); + } + + public static void syncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.updateRegistrationAsync(request).get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java new file mode 100644 index 000000000000..f786aa7c56d4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainsclient_updateregistration_registrationfieldmask_sync] +import com.google.cloud.domains.v1.DomainsClient; +import com.google.cloud.domains.v1.Registration; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistrationRegistrationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRegistrationRegistrationFieldmask(); + } + + public static void syncUpdateRegistrationRegistrationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + Registration registration = Registration.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = domainsClient.updateRegistrationAsync(registration, updateMask).get(); + } + } +} +// [END domains_v1_generated_domainsclient_updateregistration_registrationfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..0f7809a50bf8 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/domainssettings/searchdomains/SyncSearchDomains.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.samples; + +// [START domains_v1_generated_domainssettings_searchdomains_sync] +import com.google.cloud.domains.v1.DomainsSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings.Builder domainsSettingsBuilder = DomainsSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1_generated_domainssettings_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..dcff2c423f5d --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1.stub.samples; + +// [START domains_v1_generated_domainsstubsettings_searchdomains_sync] +import com.google.cloud.domains.v1.stub.DomainsStubSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsStubSettings.Builder domainsSettingsBuilder = DomainsStubSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsStubSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1_generated_domainsstubsettings_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java new file mode 100644 index 000000000000..8b1eedcc5b4a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurecontactsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettings(); + } + + public static void asyncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureContactSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurecontactsettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java new file mode 100644 index 000000000000..c340f90c2cd2 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurecontactsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettingsLRO(); + } + + public static void asyncConfigureContactSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureContactSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurecontactsettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java new file mode 100644 index 000000000000..2b67054749a4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurecontactsettings_sync] +import com.google.cloud.domains.v1alpha2.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettings(); + } + + public static void syncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureContactSettingsAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurecontactsettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java new file mode 100644 index 000000000000..47cff4014d41 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java new file mode 100644 index 000000000000..528aa19d1036 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.ContactSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsStringContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsStringContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsStringContactsettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java new file mode 100644 index 000000000000..16b5839c990d --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurednssettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettings(); + } + + public static void asyncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureDnsSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurednssettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java new file mode 100644 index 000000000000..7970165b1b34 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurednssettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettingsLRO(); + } + + public static void asyncConfigureDnsSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureDnsSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurednssettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.java new file mode 100644 index 000000000000..dd6e3f3606e6 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettings.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configurednssettings_sync] +import com.google.cloud.domains.v1alpha2.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettings(); + } + + public static void syncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureDnsSettingsAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configurednssettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java new file mode 100644 index 000000000000..f6d76049e88b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java new file mode 100644 index 000000000000..76175c993146 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DnsSettings; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsStringDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsStringDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsStringDnssettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java new file mode 100644 index 000000000000..fd61697a8da0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configuremanagementsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettings(); + } + + public static void asyncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + domainsClient.configureManagementSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configuremanagementsettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java new file mode 100644 index 000000000000..245584cf8730 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configuremanagementsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettingsLRO(); + } + + public static void asyncConfigureManagementSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.configureManagementSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configuremanagementsettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java new file mode 100644 index 000000000000..acf60bc3f91f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_configuremanagementsettings_sync] +import com.google.cloud.domains.v1alpha2.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettings(); + } + + public static void syncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.configureManagementSettingsAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_configuremanagementsettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java new file mode 100644 index 000000000000..a8e5c3e8bd03 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java new file mode 100644 index 000000000000..ad5a6047b03b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ManagementSettings; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsStringManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsStringManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsStringManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..5d88a7b88184 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.DomainsSettings; +import com.google.cloud.domains.v1alpha2.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..56badec92a0b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.DomainsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1alpha2_generated_domainsclient_create_setcredentialsprovider1_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..18480370b2e7 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_create_setendpoint_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.DomainsSettings; +import com.google.cloud.domains.v1alpha2.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = DomainsSettings.newBuilder().setEndpoint(myEndpoint).build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1alpha2_generated_domainsclient_create_setendpoint_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.java new file mode 100644 index 000000000000..739ff25763a4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistration(); + } + + public static void asyncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.deleteRegistrationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java new file mode 100644 index 000000000000..2c22798c301e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistrationLRO(); + } + + public static void asyncDeleteRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.deleteRegistrationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.java new file mode 100644 index 000000000000..606410b1d8c0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistration.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_sync] +import com.google.cloud.domains.v1alpha2.DeleteRegistrationRequest; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + syncDeleteRegistration(); + } + + public static void syncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + domainsClient.deleteRegistrationAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java new file mode 100644 index 000000000000..e203addf5aa5 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_registrationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncDeleteRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationRegistrationname(); + } + + public static void syncDeleteRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.java new file mode 100644 index 000000000000..c98b6e15e25b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/deleteregistration/SyncDeleteRegistrationString.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_deleteregistration_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncDeleteRegistrationString { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationString(); + } + + public static void syncDeleteRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_deleteregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.java new file mode 100644 index 000000000000..e8ded436a74b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncExportRegistration { + + public static void main(String[] args) throws Exception { + asyncExportRegistration(); + } + + public static void asyncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.exportRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.java new file mode 100644 index 000000000000..282f111bff5c --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/AsyncExportRegistrationLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class AsyncExportRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncExportRegistrationLRO(); + } + + public static void asyncExportRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.exportRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.java new file mode 100644 index 000000000000..d9d87dbcff03 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ExportRegistrationRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncExportRegistration { + + public static void main(String[] args) throws Exception { + syncExportRegistration(); + } + + public static void syncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.exportRegistrationAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java new file mode 100644 index 000000000000..aac34fcadc52 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_registrationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncExportRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncExportRegistrationRegistrationname(); + } + + public static void syncExportRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.java new file mode 100644 index 000000000000..03f31d58feaa --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/exportregistration/SyncExportRegistrationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_exportregistration_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncExportRegistrationString { + + public static void main(String[] args) throws Exception { + syncExportRegistrationString(); + } + + public static void syncExportRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_exportregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.java new file mode 100644 index 000000000000..379e5a6ab757 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/AsyncGetRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.GetRegistrationRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class AsyncGetRegistration { + + public static void main(String[] args) throws Exception { + asyncGetRegistration(); + } + + public static void asyncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.getRegistrationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.java new file mode 100644 index 000000000000..6c0c23fe1f64 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.GetRegistrationRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncGetRegistration { + + public static void main(String[] args) throws Exception { + syncGetRegistration(); + } + + public static void syncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.getRegistration(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java new file mode 100644 index 000000000000..83edf1d88757 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_registrationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncGetRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncGetRegistrationRegistrationname(); + } + + public static void syncGetRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.java new file mode 100644 index 000000000000..3aa2fccc905f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/getregistration/SyncGetRegistrationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_getregistration_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncGetRegistrationString { + + public static void main(String[] args) throws Exception { + syncGetRegistrationString(); + } + + public static void syncGetRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_getregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java new file mode 100644 index 000000000000..807fec1f32fa --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class AsyncListRegistrations { + + public static void main(String[] args) throws Exception { + asyncListRegistrations(); + } + + public static void asyncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + domainsClient.listRegistrationsPagedCallable().futureCall(request); + // Do something. + for (Registration element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java new file mode 100644 index 000000000000..34146e314c11 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/AsyncListRegistrationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_paged_async] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.ListRegistrationsResponse; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.common.base.Strings; + +public class AsyncListRegistrationsPaged { + + public static void main(String[] args) throws Exception { + asyncListRegistrationsPaged(); + } + + public static void asyncListRegistrationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListRegistrationsResponse response = + domainsClient.listRegistrationsCallable().call(request); + for (Registration element : response.getRegistrationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_paged_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.java new file mode 100644 index 000000000000..526a98bea98e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrations.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.ListRegistrationsRequest; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class SyncListRegistrations { + + public static void main(String[] args) throws Exception { + syncListRegistrations(); + } + + public static void syncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Registration element : domainsClient.listRegistrations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.java new file mode 100644 index 000000000000..40bf83e55e70 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_locationname_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class SyncListRegistrationsLocationname { + + public static void main(String[] args) throws Exception { + syncListRegistrationsLocationname(); + } + + public static void syncListRegistrationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_locationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.java new file mode 100644 index 000000000000..d2a659a74969 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/listregistrations/SyncListRegistrationsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_listregistrations_string_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; + +public class SyncListRegistrationsString { + + public static void main(String[] args) throws Exception { + syncListRegistrationsString(); + } + + public static void syncListRegistrationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1alpha2_generated_domainsclient_listregistrations_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java new file mode 100644 index 000000000000..b7506a7f6ce0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomain { + + public static void main(String[] args) throws Exception { + asyncRegisterDomain(); + } + + public static void asyncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.registerDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java new file mode 100644 index 000000000000..cb87c99e70cc --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/AsyncRegisterDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomainLRO { + + public static void main(String[] args) throws Exception { + asyncRegisterDomainLRO(); + } + + public static void asyncRegisterDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.registerDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java new file mode 100644 index 000000000000..e51ac179cb5f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_sync] +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RegisterDomainRequest; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncRegisterDomain { + + public static void main(String[] args) throws Exception { + syncRegisterDomain(); + } + + public static void syncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.registerDomainAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java new file mode 100644 index 000000000000..fd5725a90b97 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainLocationnameRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainLocationnameRegistrationMoney(); + } + + public static void syncRegisterDomainLocationnameRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java new file mode 100644 index 000000000000..b7cecbc9e1c4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_registerdomain_stringregistrationmoney_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainStringRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainStringRegistrationMoney(); + } + + public static void syncRegisterDomainStringRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_registerdomain_stringregistrationmoney_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java new file mode 100644 index 000000000000..8d7b2cdea8b2 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.ResetAuthorizationCodeRequest; + +public class AsyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncResetAuthorizationCode(); + } + + public static void asyncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.resetAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java new file mode 100644 index 000000000000..4dd25fc7f909 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.ResetAuthorizationCodeRequest; + +public class SyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCode(); + } + + public static void syncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java new file mode 100644 index 000000000000..672912a7e664 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncResetAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeRegistrationname(); + } + + public static void syncResetAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java new file mode 100644 index 000000000000..d7d519fdf325 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_resetauthorizationcode_string_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncResetAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeString(); + } + + public static void syncResetAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_resetauthorizationcode_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java new file mode 100644 index 000000000000..460e4d520170 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.RetrieveAuthorizationCodeRequest; + +public class AsyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncRetrieveAuthorizationCode(); + } + + public static void asyncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java new file mode 100644 index 000000000000..8db54d9194ab --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; +import com.google.cloud.domains.v1alpha2.RetrieveAuthorizationCodeRequest; + +public class SyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCode(); + } + + public static void syncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java new file mode 100644 index 000000000000..30b61d507a25 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncRetrieveAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeRegistrationname(); + } + + public static void syncRetrieveAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java new file mode 100644 index 000000000000..6c8bbab895d8 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_string_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.RegistrationName; + +public class SyncRetrieveAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeString(); + } + + public static void syncRetrieveAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveauthorizationcode_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java new file mode 100644 index 000000000000..c231c52cfa19 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class AsyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveRegisterParameters(); + } + + public static void asyncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveRegisterParametersCallable().futureCall(request); + // Do something. + RetrieveRegisterParametersResponse response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java new file mode 100644 index 000000000000..c640ac5733fb --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParameters(); + } + + public static void syncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java new file mode 100644 index 000000000000..8d524f77da5f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersLocationnameString(); + } + + public static void syncRetrieveRegisterParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java new file mode 100644 index 000000000000..ea3c8eb3f559 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_stringstring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersStringString(); + } + + public static void syncRetrieveRegisterParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrieveregisterparameters_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java new file mode 100644 index 000000000000..d17145579e41 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrievetransferparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class AsyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveTransferParameters(); + } + + public static void asyncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveTransferParametersCallable().futureCall(request); + // Do something. + RetrieveTransferParametersResponse response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java new file mode 100644 index 000000000000..6e5c8656d0e5 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrievetransferparameters_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParameters(); + } + + public static void syncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java new file mode 100644 index 000000000000..1b38d1994682 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersLocationnameString(); + } + + public static void syncRetrieveTransferParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java new file mode 100644 index 000000000000..e27d062ef7ab --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_retrievetransferparameters_stringstring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersStringString(); + } + + public static void syncRetrieveTransferParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_retrievetransferparameters_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.java new file mode 100644 index 000000000000..0394b081e1e5 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/AsyncSearchDomains.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsRequest; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class AsyncSearchDomains { + + public static void main(String[] args) throws Exception { + asyncSearchDomains(); + } + + public static void asyncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.searchDomainsCallable().futureCall(request); + // Do something. + SearchDomainsResponse response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..d4c409fa997e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomains.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsRequest; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + SearchDomainsResponse response = domainsClient.searchDomains(request); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java new file mode 100644 index 000000000000..fefca60bed0c --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_locationnamestring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class SyncSearchDomainsLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsLocationnameString(); + } + + public static void syncSearchDomainsLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.java new file mode 100644 index 000000000000..16f28a923566 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/searchdomains/SyncSearchDomainsStringString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_searchdomains_stringstring_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.SearchDomainsResponse; + +public class SyncSearchDomainsStringString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsStringString(); + } + + public static void syncSearchDomainsStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_searchdomains_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java new file mode 100644 index 000000000000..a7a910fe7508 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_transferdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomain { + + public static void main(String[] args) throws Exception { + asyncTransferDomain(); + } + + public static void asyncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.transferDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_transferdomain_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java new file mode 100644 index 000000000000..11dfe2c05abb --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/AsyncTransferDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_transferdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomainLRO { + + public static void main(String[] args) throws Exception { + asyncTransferDomainLRO(); + } + + public static void asyncTransferDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.transferDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_transferdomain_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java new file mode 100644 index 000000000000..b9f21d26ce67 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_transferdomain_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.ContactNotice; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncTransferDomain { + + public static void main(String[] args) throws Exception { + syncTransferDomain(); + } + + public static void syncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.transferDomainAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_transferdomain_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java new file mode 100644 index 000000000000..abcf7463a6fe --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java new file mode 100644 index 000000000000..198646a41cc3 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START +// domains_v1alpha2_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1alpha2.AuthorizationCode; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.LocationName; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.type.Money; + +public class SyncTransferDomainStringRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainStringRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainStringRegistrationMoneyAuthorizationcode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1alpha2_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.java new file mode 100644 index 000000000000..eb64f4f0bf04 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistration.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistration(); + } + + public static void asyncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = domainsClient.updateRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java new file mode 100644 index 000000000000..7da4e257be45 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.OperationMetadata; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistrationLRO(); + } + + public static void asyncUpdateRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.updateRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.java new file mode 100644 index 000000000000..b9c3cd9f261a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistration.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.cloud.domains.v1alpha2.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + syncUpdateRegistration(); + } + + public static void syncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.updateRegistrationAsync(request).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java new file mode 100644 index 000000000000..ab615ed6b271 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainsclient_updateregistration_registrationfieldmask_sync] +import com.google.cloud.domains.v1alpha2.DomainsClient; +import com.google.cloud.domains.v1alpha2.Registration; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistrationRegistrationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRegistrationRegistrationFieldmask(); + } + + public static void syncUpdateRegistrationRegistrationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + Registration registration = Registration.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = domainsClient.updateRegistrationAsync(registration, updateMask).get(); + } + } +} +// [END domains_v1alpha2_generated_domainsclient_updateregistration_registrationfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..dac85e194020 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/domainssettings/searchdomains/SyncSearchDomains.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.samples; + +// [START domains_v1alpha2_generated_domainssettings_searchdomains_sync] +import com.google.cloud.domains.v1alpha2.DomainsSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings.Builder domainsSettingsBuilder = DomainsSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1alpha2_generated_domainssettings_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..b2238ca58eb2 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1alpha2/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1alpha2.stub.samples; + +// [START domains_v1alpha2_generated_domainsstubsettings_searchdomains_sync] +import com.google.cloud.domains.v1alpha2.stub.DomainsStubSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsStubSettings.Builder domainsSettingsBuilder = DomainsStubSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsStubSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1alpha2_generated_domainsstubsettings_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java new file mode 100644 index 000000000000..215f09bba9b1 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettings.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurecontactsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettings(); + } + + public static void asyncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureContactSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurecontactsettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java new file mode 100644 index 000000000000..385996bbbaf4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/AsyncConfigureContactSettingsLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurecontactsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncConfigureContactSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureContactSettingsLRO(); + } + + public static void asyncConfigureContactSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureContactSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurecontactsettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java new file mode 100644 index 000000000000..5428e7055aa7 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurecontactsettings_sync] +import com.google.cloud.domains.v1beta1.ConfigureContactSettingsRequest; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncConfigureContactSettings { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettings(); + } + + public static void syncConfigureContactSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureContactSettingsRequest request = + ConfigureContactSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setContactSettings(ContactSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureContactSettingsAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurecontactsettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java new file mode 100644 index 000000000000..44a22dcf9ca8 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsRegistrationnameContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsRegistrationnameContactsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurecontactsettings_registrationnamecontactsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java new file mode 100644 index 000000000000..945c37c77c8e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurecontactsettings/SyncConfigureContactSettingsStringContactsettingsFieldmask.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.ContactSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureContactSettingsStringContactsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureContactSettingsStringContactsettingsFieldmask(); + } + + public static void syncConfigureContactSettingsStringContactsettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ContactSettings contactSettings = ContactSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureContactSettingsAsync(registration, contactSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurecontactsettings_stringcontactsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java new file mode 100644 index 000000000000..061e205d1d26 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettings.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurednssettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettings(); + } + + public static void asyncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + domainsClient.configureDnsSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurednssettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java new file mode 100644 index 000000000000..d964a7baa794 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/AsyncConfigureDnsSettingsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurednssettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureDnsSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureDnsSettingsLRO(); + } + + public static void asyncConfigureDnsSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.configureDnsSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurednssettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java new file mode 100644 index 000000000000..6fb47f600cea --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettings.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configurednssettings_sync] +import com.google.cloud.domains.v1beta1.ConfigureDnsSettingsRequest; +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettings { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettings(); + } + + public static void syncConfigureDnsSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureDnsSettingsRequest request = + ConfigureDnsSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setDnsSettings(DnsSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.configureDnsSettingsAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configurednssettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java new file mode 100644 index 000000000000..f7d660c02adc --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsRegistrationnameDnssettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurednssettings_registrationnamednssettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java new file mode 100644 index 000000000000..abc07bd12d9e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configurednssettings/SyncConfigureDnsSettingsStringDnssettingsFieldmask.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DnsSettings; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureDnsSettingsStringDnssettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureDnsSettingsStringDnssettingsFieldmask(); + } + + public static void syncConfigureDnsSettingsStringDnssettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + DnsSettings dnsSettings = DnsSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient.configureDnsSettingsAsync(registration, dnsSettings, updateMask).get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configurednssettings_stringdnssettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java new file mode 100644 index 000000000000..e31c68477839 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configuremanagementsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettings(); + } + + public static void asyncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + domainsClient.configureManagementSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configuremanagementsettings_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java new file mode 100644 index 000000000000..e4815127179c --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/AsyncConfigureManagementSettingsLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configuremanagementsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class AsyncConfigureManagementSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncConfigureManagementSettingsLRO(); + } + + public static void asyncConfigureManagementSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.configureManagementSettingsOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configuremanagementsettings_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java new file mode 100644 index 000000000000..8d757360c6d1 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettings.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_configuremanagementsettings_sync] +import com.google.cloud.domains.v1beta1.ConfigureManagementSettingsRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettings { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettings(); + } + + public static void syncConfigureManagementSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ConfigureManagementSettingsRequest request = + ConfigureManagementSettingsRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .setManagementSettings(ManagementSettings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.configureManagementSettingsAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_configuremanagementsettings_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java new file mode 100644 index 000000000000..0ca2de1824d7 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsRegistrationnameManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_registrationnamemanagementsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java new file mode 100644 index 000000000000..26146447e311 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/configuremanagementsettings/SyncConfigureManagementSettingsStringManagementsettingsFieldmask.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ManagementSettings; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.FieldMask; + +public class SyncConfigureManagementSettingsStringManagementsettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncConfigureManagementSettingsStringManagementsettingsFieldmask(); + } + + public static void syncConfigureManagementSettingsStringManagementsettingsFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + ManagementSettings managementSettings = ManagementSettings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = + domainsClient + .configureManagementSettingsAsync(registration, managementSettings, updateMask) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_configuremanagementsettings_stringmanagementsettingsfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..bc9164408170 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.DomainsSettings; +import com.google.cloud.domains.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1beta1_generated_domainsclient_create_setcredentialsprovider_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..17c532c7b91a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.DomainsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = + DomainsSettings.newBuilder() + .setTransportChannelProvider( + DomainsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1beta1_generated_domainsclient_create_setcredentialsprovider1_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..6540edf1429a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_create_setendpoint_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.DomainsSettings; +import com.google.cloud.domains.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings domainsSettings = DomainsSettings.newBuilder().setEndpoint(myEndpoint).build(); + DomainsClient domainsClient = DomainsClient.create(domainsSettings); + } +} +// [END domains_v1beta1_generated_domainsclient_create_setendpoint_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.java new file mode 100644 index 000000000000..b6ed0ec330b6 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistration(); + } + + public static void asyncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.deleteRegistrationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java new file mode 100644 index 000000000000..83766ffc645a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/AsyncDeleteRegistrationLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.protobuf.Empty; + +public class AsyncDeleteRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRegistrationLRO(); + } + + public static void asyncDeleteRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.deleteRegistrationOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.java new file mode 100644 index 000000000000..a5bf2163c456 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistration.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_sync] +import com.google.cloud.domains.v1beta1.DeleteRegistrationRequest; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncDeleteRegistration { + + public static void main(String[] args) throws Exception { + syncDeleteRegistration(); + } + + public static void syncDeleteRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + DeleteRegistrationRequest request = + DeleteRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + domainsClient.deleteRegistrationAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java new file mode 100644 index 000000000000..1cff3d025eea --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationRegistrationname.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_registrationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncDeleteRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationRegistrationname(); + } + + public static void syncDeleteRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java new file mode 100644 index 000000000000..5455fc90f886 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/deleteregistration/SyncDeleteRegistrationString.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_deleteregistration_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncDeleteRegistrationString { + + public static void main(String[] args) throws Exception { + syncDeleteRegistrationString(); + } + + public static void syncDeleteRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + domainsClient.deleteRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_deleteregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.java new file mode 100644 index 000000000000..f2278a4227bb --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.longrunning.Operation; + +public class AsyncExportRegistration { + + public static void main(String[] args) throws Exception { + asyncExportRegistration(); + } + + public static void asyncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.exportRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java new file mode 100644 index 000000000000..53b883e3a9e2 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/AsyncExportRegistrationLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class AsyncExportRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncExportRegistrationLRO(); + } + + public static void asyncExportRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + OperationFuture future = + domainsClient.exportRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.java new file mode 100644 index 000000000000..2b89bc9377f0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ExportRegistrationRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncExportRegistration { + + public static void main(String[] args) throws Exception { + syncExportRegistration(); + } + + public static void syncExportRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ExportRegistrationRequest request = + ExportRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.exportRegistrationAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java new file mode 100644 index 000000000000..439a949417a9 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationRegistrationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_registrationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncExportRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncExportRegistrationRegistrationname(); + } + + public static void syncExportRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.java new file mode 100644 index 000000000000..26d4adf33c80 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/exportregistration/SyncExportRegistrationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_exportregistration_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncExportRegistrationString { + + public static void main(String[] args) throws Exception { + syncExportRegistrationString(); + } + + public static void syncExportRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.exportRegistrationAsync(name).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_exportregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.java new file mode 100644 index 000000000000..6b221ce5350c --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/AsyncGetRegistration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.GetRegistrationRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class AsyncGetRegistration { + + public static void main(String[] args) throws Exception { + asyncGetRegistration(); + } + + public static void asyncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = domainsClient.getRegistrationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.java new file mode 100644 index 000000000000..378b99fd4df6 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.GetRegistrationRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncGetRegistration { + + public static void main(String[] args) throws Exception { + syncGetRegistration(); + } + + public static void syncGetRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + GetRegistrationRequest request = + GetRegistrationRequest.newBuilder() + .setName(RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + Registration response = domainsClient.getRegistration(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java new file mode 100644 index 000000000000..15cf0f48c722 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationRegistrationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_registrationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncGetRegistrationRegistrationname { + + public static void main(String[] args) throws Exception { + syncGetRegistrationRegistrationname(); + } + + public static void syncGetRegistrationRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.java new file mode 100644 index 000000000000..64bc510c7332 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/getregistration/SyncGetRegistrationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_getregistration_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncGetRegistrationString { + + public static void main(String[] args) throws Exception { + syncGetRegistrationString(); + } + + public static void syncGetRegistrationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String name = RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + Registration response = domainsClient.getRegistration(name); + } + } +} +// [END domains_v1beta1_generated_domainsclient_getregistration_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java new file mode 100644 index 000000000000..49b03a339b05 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class AsyncListRegistrations { + + public static void main(String[] args) throws Exception { + asyncListRegistrations(); + } + + public static void asyncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + domainsClient.listRegistrationsPagedCallable().futureCall(request); + // Do something. + for (Registration element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java new file mode 100644 index 000000000000..070a062819cc --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/AsyncListRegistrationsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_paged_async] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.ListRegistrationsResponse; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.common.base.Strings; + +public class AsyncListRegistrationsPaged { + + public static void main(String[] args) throws Exception { + asyncListRegistrationsPaged(); + } + + public static void asyncListRegistrationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListRegistrationsResponse response = + domainsClient.listRegistrationsCallable().call(request); + for (Registration element : response.getRegistrationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_paged_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.java new file mode 100644 index 000000000000..0e15bff59a1a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrations.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.ListRegistrationsRequest; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class SyncListRegistrations { + + public static void main(String[] args) throws Exception { + syncListRegistrations(); + } + + public static void syncListRegistrations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ListRegistrationsRequest request = + ListRegistrationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Registration element : domainsClient.listRegistrations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java new file mode 100644 index 000000000000..824acde8c37f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_locationname_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class SyncListRegistrationsLocationname { + + public static void main(String[] args) throws Exception { + syncListRegistrationsLocationname(); + } + + public static void syncListRegistrationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_locationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.java new file mode 100644 index 000000000000..01cbf30bb06a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/listregistrations/SyncListRegistrationsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_listregistrations_string_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; + +public class SyncListRegistrationsString { + + public static void main(String[] args) throws Exception { + syncListRegistrationsString(); + } + + public static void syncListRegistrationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Registration element : domainsClient.listRegistrations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END domains_v1beta1_generated_domainsclient_listregistrations_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java new file mode 100644 index 000000000000..5950d03a7f7b --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomain { + + public static void main(String[] args) throws Exception { + asyncRegisterDomain(); + } + + public static void asyncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.registerDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java new file mode 100644 index 000000000000..17fb1f93d995 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/AsyncRegisterDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncRegisterDomainLRO { + + public static void main(String[] args) throws Exception { + asyncRegisterDomainLRO(); + } + + public static void asyncRegisterDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.registerDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java new file mode 100644 index 000000000000..65a832a57d83 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_sync] +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RegisterDomainRequest; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncRegisterDomain { + + public static void main(String[] args) throws Exception { + syncRegisterDomain(); + } + + public static void syncRegisterDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllDomainNotices(new ArrayList()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.registerDomainAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java new file mode 100644 index 000000000000..c288a90db296 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainLocationnameRegistrationMoney.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainLocationnameRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainLocationnameRegistrationMoney(); + } + + public static void syncRegisterDomainLocationnameRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_locationnameregistrationmoney_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java new file mode 100644 index 000000000000..bb16e9f82430 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/registerdomain/SyncRegisterDomainStringRegistrationMoney.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncRegisterDomainStringRegistrationMoney { + + public static void main(String[] args) throws Exception { + syncRegisterDomainStringRegistrationMoney(); + } + + public static void syncRegisterDomainStringRegistrationMoney() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + Registration response = + domainsClient.registerDomainAsync(parent, registration, yearlyPrice).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_registerdomain_stringregistrationmoney_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java new file mode 100644 index 000000000000..697007d60eb7 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/AsyncResetAuthorizationCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.ResetAuthorizationCodeRequest; + +public class AsyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncResetAuthorizationCode(); + } + + public static void asyncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.resetAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java new file mode 100644 index 000000000000..56a39840cb39 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCode.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.ResetAuthorizationCodeRequest; + +public class SyncResetAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCode(); + } + + public static void syncResetAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + ResetAuthorizationCodeRequest request = + ResetAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java new file mode 100644 index 000000000000..4c254701d246 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeRegistrationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncResetAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeRegistrationname(); + } + + public static void syncResetAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java new file mode 100644 index 000000000000..60cfee8be888 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/resetauthorizationcode/SyncResetAuthorizationCodeString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_resetauthorizationcode_string_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncResetAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncResetAuthorizationCodeString(); + } + + public static void syncResetAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.resetAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_resetauthorizationcode_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java new file mode 100644 index 000000000000..612ae6b2a8a0 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/AsyncRetrieveAuthorizationCode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.RetrieveAuthorizationCodeRequest; + +public class AsyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + asyncRetrieveAuthorizationCode(); + } + + public static void asyncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveAuthorizationCodeCallable().futureCall(request); + // Do something. + AuthorizationCode response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java new file mode 100644 index 000000000000..917c3b7c868f --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCode.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; +import com.google.cloud.domains.v1beta1.RetrieveAuthorizationCodeRequest; + +public class SyncRetrieveAuthorizationCode { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCode(); + } + + public static void syncRetrieveAuthorizationCode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveAuthorizationCodeRequest request = + RetrieveAuthorizationCodeRequest.newBuilder() + .setRegistration( + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString()) + .build(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java new file mode 100644 index 000000000000..363a049572db --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeRegistrationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeRegistrationname { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeRegistrationname(); + } + + public static void syncRetrieveAuthorizationCodeRegistrationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RegistrationName registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]"); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_registrationname_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java new file mode 100644 index 000000000000..cc51a1865bae --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveauthorizationcode/SyncRetrieveAuthorizationCodeString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_string_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.RegistrationName; + +public class SyncRetrieveAuthorizationCodeString { + + public static void main(String[] args) throws Exception { + syncRetrieveAuthorizationCodeString(); + } + + public static void syncRetrieveAuthorizationCodeString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String registration = + RegistrationName.of("[PROJECT]", "[LOCATION]", "[REGISTRATION]").toString(); + AuthorizationCode response = domainsClient.retrieveAuthorizationCode(registration); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveauthorizationcode_string_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java new file mode 100644 index 000000000000..7734f38886cb --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/AsyncRetrieveRegisterParameters.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveregisterparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class AsyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveRegisterParameters(); + } + + public static void asyncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveRegisterParametersCallable().futureCall(request); + // Do something. + RetrieveRegisterParametersResponse response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java new file mode 100644 index 000000000000..51ef10710a3e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParameters.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveregisterparameters_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParameters(); + } + + public static void syncRetrieveRegisterParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveRegisterParametersRequest request = + RetrieveRegisterParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java new file mode 100644 index 000000000000..086eb006e369 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersLocationnameString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersLocationnameString(); + } + + public static void syncRetrieveRegisterParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java new file mode 100644 index 000000000000..b9644acf51c6 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrieveregisterparameters/SyncRetrieveRegisterParametersStringString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveRegisterParametersResponse; + +public class SyncRetrieveRegisterParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveRegisterParametersStringString(); + } + + public static void syncRetrieveRegisterParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveRegisterParametersResponse response = + domainsClient.retrieveRegisterParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrieveregisterparameters_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java new file mode 100644 index 000000000000..bf6d0fab0c6e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/AsyncRetrieveTransferParameters.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrievetransferparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class AsyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + asyncRetrieveTransferParameters(); + } + + public static void asyncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.retrieveTransferParametersCallable().futureCall(request); + // Do something. + RetrieveTransferParametersResponse response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java new file mode 100644 index 000000000000..05fc65a525a4 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParameters.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrievetransferparameters_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersRequest; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParameters { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParameters(); + } + + public static void syncRetrieveTransferParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + RetrieveTransferParametersRequest request = + RetrieveTransferParametersRequest.newBuilder() + .setDomainName("domainName-1244085905") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java new file mode 100644 index 000000000000..ef57992a5775 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersLocationnameString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersLocationnameString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersLocationnameString(); + } + + public static void syncRetrieveTransferParametersLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java new file mode 100644 index 000000000000..ef253fd6e17d --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/retrievetransferparameters/SyncRetrieveTransferParametersStringString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_retrievetransferparameters_stringstring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.RetrieveTransferParametersResponse; + +public class SyncRetrieveTransferParametersStringString { + + public static void main(String[] args) throws Exception { + syncRetrieveTransferParametersStringString(); + } + + public static void syncRetrieveTransferParametersStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String domainName = "domainName-1244085905"; + RetrieveTransferParametersResponse response = + domainsClient.retrieveTransferParameters(location, domainName); + } + } +} +// [END domains_v1beta1_generated_domainsclient_retrievetransferparameters_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.java new file mode 100644 index 000000000000..d97c5ea95364 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/AsyncSearchDomains.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsRequest; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class AsyncSearchDomains { + + public static void main(String[] args) throws Exception { + asyncSearchDomains(); + } + + public static void asyncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + domainsClient.searchDomainsCallable().futureCall(request); + // Do something. + SearchDomainsResponse response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..e3c366d1023a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomains.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsRequest; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + SearchDomainsRequest request = + SearchDomainsRequest.newBuilder() + .setQuery("query107944136") + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + SearchDomainsResponse response = domainsClient.searchDomains(request); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java new file mode 100644 index 000000000000..dfcfa1eff538 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsLocationnameString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_locationnamestring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class SyncSearchDomainsLocationnameString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsLocationnameString(); + } + + public static void syncSearchDomainsLocationnameString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_locationnamestring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.java new file mode 100644 index 000000000000..d8ca63f54d74 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/searchdomains/SyncSearchDomainsStringString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_searchdomains_stringstring_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.SearchDomainsResponse; + +public class SyncSearchDomainsStringString { + + public static void main(String[] args) throws Exception { + syncSearchDomainsStringString(); + } + + public static void syncSearchDomainsStringString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + String query = "query107944136"; + SearchDomainsResponse response = domainsClient.searchDomains(location, query); + } + } +} +// [END domains_v1beta1_generated_domainsclient_searchdomains_stringstring_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java new file mode 100644 index 000000000000..14447c6a4c3d --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomain.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_transferdomain_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.longrunning.Operation; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomain { + + public static void main(String[] args) throws Exception { + asyncTransferDomain(); + } + + public static void asyncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = domainsClient.transferDomainCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_transferdomain_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java new file mode 100644 index 000000000000..c44656efbfbd --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/AsyncTransferDomainLRO.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_transferdomain_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class AsyncTransferDomainLRO { + + public static void main(String[] args) throws Exception { + asyncTransferDomainLRO(); + } + + public static void asyncTransferDomainLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + domainsClient.transferDomainOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_transferdomain_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java new file mode 100644 index 000000000000..a1276fbfe7a1 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomain.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_transferdomain_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.ContactNotice; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.TransferDomainRequest; +import com.google.type.Money; +import java.util.ArrayList; + +public class SyncTransferDomain { + + public static void main(String[] args) throws Exception { + syncTransferDomain(); + } + + public static void syncTransferDomain() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + TransferDomainRequest request = + TransferDomainRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setRegistration(Registration.newBuilder().build()) + .addAllContactNotices(new ArrayList()) + .setYearlyPrice(Money.newBuilder().build()) + .setAuthorizationCode(AuthorizationCode.newBuilder().build()) + .setValidateOnly(true) + .build(); + Registration response = domainsClient.transferDomainAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_transferdomain_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java new file mode 100644 index 000000000000..3ff5c935163e --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainLocationnameRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainLocationnameRegistrationMoneyAuthorizationcode() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_transferdomain_locationnameregistrationmoneyauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java new file mode 100644 index 000000000000..bbc55f7c15a5 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/transferdomain/SyncTransferDomainStringRegistrationMoneyAuthorizationcode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START +// domains_v1beta1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] +import com.google.cloud.domains.v1beta1.AuthorizationCode; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.LocationName; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.type.Money; + +public class SyncTransferDomainStringRegistrationMoneyAuthorizationcode { + + public static void main(String[] args) throws Exception { + syncTransferDomainStringRegistrationMoneyAuthorizationcode(); + } + + public static void syncTransferDomainStringRegistrationMoneyAuthorizationcode() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Registration registration = Registration.newBuilder().build(); + Money yearlyPrice = Money.newBuilder().build(); + AuthorizationCode authorizationCode = AuthorizationCode.newBuilder().build(); + Registration response = + domainsClient + .transferDomainAsync(parent, registration, yearlyPrice, authorizationCode) + .get(); + } + } +} +// [END +// domains_v1beta1_generated_domainsclient_transferdomain_stringregistrationmoneyauthorizationcode_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.java new file mode 100644 index 000000000000..288632589ff3 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistration.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistration(); + } + + public static void asyncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = domainsClient.updateRegistrationCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java new file mode 100644 index 000000000000..2a19fae5e0da --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/AsyncUpdateRegistrationLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.OperationMetadata; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRegistrationLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRegistrationLRO(); + } + + public static void asyncUpdateRegistrationLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + domainsClient.updateRegistrationOperationCallable().futureCall(request); + // Do something. + Registration response = future.get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_lro_async] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.java new file mode 100644 index 000000000000..6d1dd4d935b3 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistration.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.cloud.domains.v1beta1.UpdateRegistrationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistration { + + public static void main(String[] args) throws Exception { + syncUpdateRegistration(); + } + + public static void syncUpdateRegistration() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + UpdateRegistrationRequest request = + UpdateRegistrationRequest.newBuilder() + .setRegistration(Registration.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Registration response = domainsClient.updateRegistrationAsync(request).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java new file mode 100644 index 000000000000..6353ec26eebe --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainsclient/updateregistration/SyncUpdateRegistrationRegistrationFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainsclient_updateregistration_registrationfieldmask_sync] +import com.google.cloud.domains.v1beta1.DomainsClient; +import com.google.cloud.domains.v1beta1.Registration; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRegistrationRegistrationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRegistrationRegistrationFieldmask(); + } + + public static void syncUpdateRegistrationRegistrationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (DomainsClient domainsClient = DomainsClient.create()) { + Registration registration = Registration.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Registration response = domainsClient.updateRegistrationAsync(registration, updateMask).get(); + } + } +} +// [END domains_v1beta1_generated_domainsclient_updateregistration_registrationfieldmask_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..62b1cc73d4b9 --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/domainssettings/searchdomains/SyncSearchDomains.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.samples; + +// [START domains_v1beta1_generated_domainssettings_searchdomains_sync] +import com.google.cloud.domains.v1beta1.DomainsSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsSettings.Builder domainsSettingsBuilder = DomainsSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1beta1_generated_domainssettings_searchdomains_sync] diff --git a/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java new file mode 100644 index 000000000000..344ebbb0f05a --- /dev/null +++ b/java-domains/samples/snippets/generated/com/google/cloud/domains/v1beta1/stub/domainsstubsettings/searchdomains/SyncSearchDomains.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.domains.v1beta1.stub.samples; + +// [START domains_v1beta1_generated_domainsstubsettings_searchdomains_sync] +import com.google.cloud.domains.v1beta1.stub.DomainsStubSettings; +import java.time.Duration; + +public class SyncSearchDomains { + + public static void main(String[] args) throws Exception { + syncSearchDomains(); + } + + public static void syncSearchDomains() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + DomainsStubSettings.Builder domainsSettingsBuilder = DomainsStubSettings.newBuilder(); + domainsSettingsBuilder + .searchDomainsSettings() + .setRetrySettings( + domainsSettingsBuilder + .searchDomainsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + DomainsStubSettings domainsSettings = domainsSettingsBuilder.build(); + } +} +// [END domains_v1beta1_generated_domainsstubsettings_searchdomains_sync]