From b2260c87d95f91517b4cbeb949035936ff875b3c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 Jun 2022 15:10:17 +0000 Subject: [PATCH] feat: Enable REST transport for most of Java and Go clients (#311) - [ ] 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 --- google-cloud-channel/pom.xml | 16 + .../channel/v1/CloudChannelServiceClient.java | 38 +- .../v1/CloudChannelServiceSettings.java | 23 +- .../v1/stub/CloudChannelServiceStub.java | 6 +- .../stub/CloudChannelServiceStubSettings.java | 53 +- ...sonCloudChannelServiceCallableFactory.java | 105 + .../stub/HttpJsonCloudChannelServiceStub.java | 3130 ++++++++++++++++ ...CloudChannelServiceClientHttpJsonTest.java | 3318 +++++++++++++++++ .../AsyncActivateEntitlement.java | 47 + .../AsyncActivateEntitlementLRO.java | 48 + .../SyncActivateEntitlement.java | 43 + .../AsyncCancelEntitlement.java | 47 + .../AsyncCancelEntitlementLRO.java | 48 + .../SyncCancelEntitlement.java | 42 + .../changeoffer/AsyncChangeOffer.java | 53 + .../changeoffer/AsyncChangeOfferLRO.java | 54 + .../changeoffer/SyncChangeOffer.java | 49 + .../AsyncChangeParameters.java | 51 + .../AsyncChangeParametersLRO.java | 52 + .../SyncChangeParameters.java | 47 + .../AsyncChangeRenewalSettings.java | 49 + .../AsyncChangeRenewalSettingsLRO.java | 50 + .../SyncChangeRenewalSettings.java | 45 + .../AsyncCheckCloudIdentityAccountsExist.java | 47 + .../SyncCheckCloudIdentityAccountsExist.java | 44 + .../SyncCreateSetCredentialsProvider.java | 42 + .../SyncCreateSetCredentialsProvider1.java | 41 + .../create/SyncCreateSetEndpoint.java | 39 + .../AsyncCreateChannelPartnerLink.java | 47 + .../SyncCreateChannelPartnerLink.java | 43 + ...ncCreateChannelPartnerRepricingConfig.java | 51 + ...ncCreateChannelPartnerRepricingConfig.java | 46 + ...linknameChannelpartnerrepricingconfig.java | 49 + ...igStringChannelpartnerrepricingconfig.java | 46 + .../createcustomer/AsyncCreateCustomer.java | 47 + .../createcustomer/SyncCreateCustomer.java | 43 + .../AsyncCreateCustomerRepricingConfig.java | 48 + .../SyncCreateCustomerRepricingConfig.java | 45 + ...igCustomernameCustomerrepricingconfig.java | 45 + ...ngConfigStringCustomerrepricingconfig.java | 45 + .../AsyncCreateEntitlement.java | 50 + .../AsyncCreateEntitlementLRO.java | 50 + .../SyncCreateEntitlement.java | 45 + ...ncDeleteChannelPartnerRepricingConfig.java | 52 + ...ncDeleteChannelPartnerRepricingConfig.java | 45 + ...nfigChannelpartnerrepricingconfigname.java | 43 + ...teChannelPartnerRepricingConfigString.java | 43 + .../deletecustomer/AsyncDeleteCustomer.java | 47 + .../deletecustomer/SyncDeleteCustomer.java | 42 + .../SyncDeleteCustomerCustomername.java | 38 + .../SyncDeleteCustomerString.java | 38 + .../AsyncDeleteCustomerRepricingConfig.java | 50 + .../SyncDeleteCustomerRepricingConfig.java | 45 + ...cingConfigCustomerrepricingconfigname.java | 42 + ...ncDeleteCustomerRepricingConfigString.java | 40 + .../AsyncGetChannelPartnerLink.java | 48 + .../SyncGetChannelPartnerLink.java | 44 + ...AsyncGetChannelPartnerRepricingConfig.java | 50 + .../SyncGetChannelPartnerRepricingConfig.java | 47 + ...nfigChannelpartnerrepricingconfigname.java | 45 + ...etChannelPartnerRepricingConfigString.java | 44 + .../getcustomer/AsyncGetCustomer.java | 47 + .../getcustomer/SyncGetCustomer.java | 43 + .../SyncGetCustomerCustomername.java | 39 + .../getcustomer/SyncGetCustomerString.java | 39 + .../AsyncGetCustomerRepricingConfig.java | 50 + .../SyncGetCustomerRepricingConfig.java | 47 + ...cingConfigCustomerrepricingconfigname.java | 42 + .../SyncGetCustomerRepricingConfigString.java | 41 + .../getentitlement/AsyncGetEntitlement.java | 47 + .../getentitlement/SyncGetEntitlement.java | 43 + .../importcustomer/AsyncImportCustomer.java | 51 + .../importcustomer/SyncImportCustomer.java | 47 + .../AsyncListChannelPartnerLinks.java | 52 + .../AsyncListChannelPartnerLinksPaged.java | 60 + .../SyncListChannelPartnerLinks.java | 49 + ...yncListChannelPartnerRepricingConfigs.java | 55 + ...stChannelPartnerRepricingConfigsPaged.java | 64 + ...yncListChannelPartnerRepricingConfigs.java | 50 + ...epricingConfigsChannelpartnerlinkname.java | 46 + ...tChannelPartnerRepricingConfigsString.java | 44 + .../AsyncListCustomerRepricingConfigs.java | 52 + ...syncListCustomerRepricingConfigsPaged.java | 60 + .../SyncListCustomerRepricingConfigs.java | 49 + ...tCustomerRepricingConfigsCustomername.java | 44 + ...yncListCustomerRepricingConfigsString.java | 42 + .../listcustomers/AsyncListCustomers.java | 51 + .../AsyncListCustomersPaged.java | 59 + .../listcustomers/SyncListCustomers.java | 47 + .../AsyncListEntitlements.java | 51 + .../AsyncListEntitlementsPaged.java | 59 + .../SyncListEntitlements.java | 47 + .../listoffers/AsyncListOffers.java | 52 + .../listoffers/AsyncListOffersPaged.java | 59 + .../listoffers/SyncListOffers.java | 48 + .../listproducts/AsyncListProducts.java | 51 + .../listproducts/AsyncListProductsPaged.java | 59 + .../listproducts/SyncListProducts.java | 47 + .../AsyncListPurchasableOffers.java | 52 + .../AsyncListPurchasableOffersPaged.java | 60 + .../SyncListPurchasableOffers.java | 49 + .../AsyncListPurchasableSkus.java | 52 + .../AsyncListPurchasableSkusPaged.java | 60 + .../SyncListPurchasableSkus.java | 49 + .../listskus/AsyncListSkus.java | 52 + .../listskus/AsyncListSkusPaged.java | 60 + .../listskus/SyncListSkus.java | 49 + .../listsubscribers/AsyncListSubscribers.java | 49 + .../AsyncListSubscribersPaged.java | 57 + .../listsubscribers/SyncListSubscribers.java | 45 + .../AsyncListTransferableOffers.java | 52 + .../AsyncListTransferableOffersPaged.java | 60 + .../SyncListTransferableOffers.java | 49 + .../AsyncListTransferableSkus.java | 52 + .../AsyncListTransferableSkusPaged.java | 60 + .../SyncListTransferableSkus.java | 49 + .../lookupoffer/AsyncLookupOffer.java | 47 + .../lookupoffer/SyncLookupOffer.java | 44 + .../AsyncProvisionCloudIdentity.java | 52 + .../AsyncProvisionCloudIdentityLRO.java | 53 + .../SyncProvisionCloudIdentity.java | 48 + .../AsyncRegisterSubscriber.java | 47 + .../SyncRegisterSubscriber.java | 43 + .../AsyncStartPaidService.java | 47 + .../AsyncStartPaidServiceLRO.java | 48 + .../SyncStartPaidService.java | 43 + .../AsyncSuspendEntitlement.java | 47 + .../AsyncSuspendEntitlementLRO.java | 48 + .../SyncSuspendEntitlement.java | 43 + .../AsyncTransferEntitlements.java | 51 + .../AsyncTransferEntitlementsLRO.java | 52 + .../SyncTransferEntitlements.java | 48 + .../AsyncTransferEntitlementsToGoogle.java | 50 + .../AsyncTransferEntitlementsToGoogleLRO.java | 53 + .../SyncTransferEntitlementsToGoogle.java | 45 + .../AsyncUnregisterSubscriber.java | 47 + .../SyncUnregisterSubscriber.java | 44 + .../AsyncUpdateChannelPartnerLink.java | 49 + .../SyncUpdateChannelPartnerLink.java | 45 + ...ncUpdateChannelPartnerRepricingConfig.java | 48 + ...ncUpdateChannelPartnerRepricingConfig.java | 43 + ...ngConfigChannelpartnerrepricingconfig.java | 44 + .../updatecustomer/AsyncUpdateCustomer.java | 48 + .../updatecustomer/SyncUpdateCustomer.java | 44 + .../AsyncUpdateCustomerRepricingConfig.java | 46 + .../SyncUpdateCustomerRepricingConfig.java | 43 + ...epricingConfigCustomerrepricingconfig.java | 42 + .../getcustomer/SyncGetCustomer.java | 47 + .../getcustomer/SyncGetCustomer.java | 47 + 149 files changed, 13454 insertions(+), 11 deletions(-) create mode 100644 google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceCallableFactory.java create mode 100644 google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceStub.java create mode 100644 google-cloud-channel/src/test/java/com/google/cloud/channel/v1/CloudChannelServiceClientHttpJsonTest.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlementLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/SyncActivateEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlementLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/SyncCancelEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOffer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOfferLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/SyncChangeOffer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParameters.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParametersLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/SyncChangeParameters.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettings.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettingsLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/SyncChangeRenewalSettings.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/AsyncCheckCloudIdentityAccountsExist.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/SyncCheckCloudIdentityAccountsExist.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/AsyncCreateChannelPartnerLink.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/SyncCreateChannelPartnerLink.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/AsyncCreateChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/AsyncCreateCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/SyncCreateCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/AsyncCreateCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigStringCustomerrepricingconfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlementLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/SyncCreateEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/AsyncDeleteChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/AsyncDeleteCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerCustomername.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/AsyncDeleteCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigCustomerrepricingconfigname.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/AsyncGetChannelPartnerLink.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/SyncGetChannelPartnerLink.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/AsyncGetChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/AsyncGetCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerCustomername.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/AsyncGetCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigCustomerrepricingconfigname.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/AsyncGetEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/SyncGetEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/AsyncImportCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/SyncImportCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinks.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinksPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/SyncListChannelPartnerLinks.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigs.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigs.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsChannelpartnerlinkname.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigs.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigs.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsCustomername.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsString.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomersPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/SyncListCustomers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlements.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlementsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/SyncListEntitlements.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffersPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/SyncListOffers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProducts.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProductsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/SyncListProducts.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffersPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/SyncListPurchasableOffers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkus.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkusPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/SyncListPurchasableSkus.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkus.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkusPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/SyncListSkus.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribersPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/SyncListSubscribers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffersPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/SyncListTransferableOffers.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkus.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkusPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/SyncListTransferableSkus.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/AsyncLookupOffer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/SyncLookupOffer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentity.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/SyncProvisionCloudIdentity.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/AsyncRegisterSubscriber.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/SyncRegisterSubscriber.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidService.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidServiceLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/SyncStartPaidService.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlementLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/SyncSuspendEntitlement.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlements.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlementsLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/SyncTransferEntitlements.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogle.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogleLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/SyncTransferEntitlementsToGoogle.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/AsyncUnregisterSubscriber.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/SyncUnregisterSubscriber.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/AsyncUpdateChannelPartnerLink.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/SyncUpdateChannelPartnerLink.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/AsyncUpdateChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/AsyncUpdateCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/SyncUpdateCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/AsyncUpdateCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfigCustomerrepricingconfig.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelservicesettings/getcustomer/SyncGetCustomer.java create mode 100644 samples/snippets/generated/com/google/cloud/channel/v1/stub/cloudchannelservicestubsettings/getcustomer/SyncGetCustomer.java diff --git a/google-cloud-channel/pom.xml b/google-cloud-channel/pom.xml index 3c05b46c..8919d953 100644 --- a/google-cloud-channel/pom.xml +++ b/google-cloud-channel/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -77,12 +81,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/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceClient.java b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceClient.java index 1806bf65..c5ac27e9 100644 --- a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceClient.java +++ b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceClient.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.channel.v1.stub.CloudChannelServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -120,13 +120,29 @@ * CloudChannelServiceClient.create(cloudChannelServiceSettings); * } * + *

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.
+ * CloudChannelServiceSettings cloudChannelServiceSettings =
+ *     CloudChannelServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             CloudChannelServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * CloudChannelServiceClient cloudChannelServiceClient =
+ *     CloudChannelServiceClient.create(cloudChannelServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class CloudChannelServiceClient implements BackgroundResource { private final CloudChannelServiceSettings settings; private final CloudChannelServiceStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of CloudChannelServiceClient with default settings. */ public static final CloudChannelServiceClient create() throws IOException { @@ -158,13 +174,17 @@ public static final CloudChannelServiceClient create(CloudChannelServiceStub stu protected CloudChannelServiceClient(CloudChannelServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((CloudChannelServiceStubSettings) 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 CloudChannelServiceClient(CloudChannelServiceStub 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 CloudChannelServiceSettings getSettings() { @@ -179,10 +199,18 @@ public CloudChannelServiceStub 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. /** * List [Customer][google.cloud.channel.v1.Customer]s. diff --git a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceSettings.java b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceSettings.java index d492414a..b24873ce 100644 --- a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceSettings.java +++ b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/CloudChannelServiceSettings.java @@ -35,6 +35,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; @@ -480,11 +481,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return CloudChannelServiceStubSettings.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 CloudChannelServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return CloudChannelServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return CloudChannelServiceStubSettings.defaultTransportChannelProvider(); } @@ -494,11 +502,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return CloudChannelServiceStubSettings.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); @@ -536,6 +550,11 @@ private static Builder createDefault() { return new Builder(CloudChannelServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(CloudChannelServiceStubSettings.newHttpJsonBuilder()); + } + public CloudChannelServiceStubSettings.Builder getStubSettingsBuilder() { return ((CloudChannelServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStub.java b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStub.java index 35297ea2..2041f4b5 100644 --- a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStub.java +++ b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStub.java @@ -117,7 +117,11 @@ public abstract class CloudChannelServiceStub 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 diff --git a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStubSettings.java b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStubSettings.java index 8293bfca..7e590995 100644 --- a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStubSettings.java +++ b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/CloudChannelServiceStubSettings.java @@ -40,6 +40,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; @@ -1485,6 +1488,11 @@ public CloudChannelServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcCloudChannelServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonCloudChannelServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -1517,18 +1525,25 @@ 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(CloudChannelServiceStubSettings.class)) @@ -1536,11 +1551,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil 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(CloudChannelServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CloudChannelServiceStubSettings.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); @@ -2086,6 +2120,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 .listCustomersSettings() diff --git a/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceCallableFactory.java b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceCallableFactory.java new file mode 100644 index 00000000..f437f70f --- /dev/null +++ b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceCallableFactory.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.channel.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 CloudChannelService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonCloudChannelServiceCallableFactory + 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/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceStub.java b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceStub.java new file mode 100644 index 00000000..ae5dbd56 --- /dev/null +++ b/google-cloud-channel/src/main/java/com/google/cloud/channel/v1/stub/HttpJsonCloudChannelServiceStub.java @@ -0,0 +1,3130 @@ +/* + * 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.channel.v1.stub; + +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListChannelPartnerLinksPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListChannelPartnerRepricingConfigsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListCustomerRepricingConfigsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListCustomersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListEntitlementsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListOffersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListProductsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListPurchasableOffersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListPurchasableSkusPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListSkusPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListSubscribersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListTransferableOffersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListTransferableSkusPagedResponse; + +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.channel.v1.ActivateEntitlementRequest; +import com.google.cloud.channel.v1.CancelEntitlementRequest; +import com.google.cloud.channel.v1.ChangeOfferRequest; +import com.google.cloud.channel.v1.ChangeParametersRequest; +import com.google.cloud.channel.v1.ChangeRenewalSettingsRequest; +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CheckCloudIdentityAccountsExistRequest; +import com.google.cloud.channel.v1.CheckCloudIdentityAccountsExistResponse; +import com.google.cloud.channel.v1.CreateChannelPartnerLinkRequest; +import com.google.cloud.channel.v1.CreateChannelPartnerRepricingConfigRequest; +import com.google.cloud.channel.v1.CreateCustomerRepricingConfigRequest; +import com.google.cloud.channel.v1.CreateCustomerRequest; +import com.google.cloud.channel.v1.CreateEntitlementRequest; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.DeleteChannelPartnerRepricingConfigRequest; +import com.google.cloud.channel.v1.DeleteCustomerRepricingConfigRequest; +import com.google.cloud.channel.v1.DeleteCustomerRequest; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.GetChannelPartnerLinkRequest; +import com.google.cloud.channel.v1.GetChannelPartnerRepricingConfigRequest; +import com.google.cloud.channel.v1.GetCustomerRepricingConfigRequest; +import com.google.cloud.channel.v1.GetCustomerRequest; +import com.google.cloud.channel.v1.GetEntitlementRequest; +import com.google.cloud.channel.v1.ImportCustomerRequest; +import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest; +import com.google.cloud.channel.v1.ListChannelPartnerLinksResponse; +import com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest; +import com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse; +import com.google.cloud.channel.v1.ListCustomerRepricingConfigsRequest; +import com.google.cloud.channel.v1.ListCustomerRepricingConfigsResponse; +import com.google.cloud.channel.v1.ListCustomersRequest; +import com.google.cloud.channel.v1.ListCustomersResponse; +import com.google.cloud.channel.v1.ListEntitlementsRequest; +import com.google.cloud.channel.v1.ListEntitlementsResponse; +import com.google.cloud.channel.v1.ListOffersRequest; +import com.google.cloud.channel.v1.ListOffersResponse; +import com.google.cloud.channel.v1.ListProductsRequest; +import com.google.cloud.channel.v1.ListProductsResponse; +import com.google.cloud.channel.v1.ListPurchasableOffersRequest; +import com.google.cloud.channel.v1.ListPurchasableOffersResponse; +import com.google.cloud.channel.v1.ListPurchasableSkusRequest; +import com.google.cloud.channel.v1.ListPurchasableSkusResponse; +import com.google.cloud.channel.v1.ListSkusRequest; +import com.google.cloud.channel.v1.ListSkusResponse; +import com.google.cloud.channel.v1.ListSubscribersRequest; +import com.google.cloud.channel.v1.ListSubscribersResponse; +import com.google.cloud.channel.v1.ListTransferableOffersRequest; +import com.google.cloud.channel.v1.ListTransferableOffersResponse; +import com.google.cloud.channel.v1.ListTransferableSkusRequest; +import com.google.cloud.channel.v1.ListTransferableSkusResponse; +import com.google.cloud.channel.v1.LookupOfferRequest; +import com.google.cloud.channel.v1.Offer; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.ProvisionCloudIdentityRequest; +import com.google.cloud.channel.v1.RegisterSubscriberRequest; +import com.google.cloud.channel.v1.RegisterSubscriberResponse; +import com.google.cloud.channel.v1.StartPaidServiceRequest; +import com.google.cloud.channel.v1.SuspendEntitlementRequest; +import com.google.cloud.channel.v1.TransferEntitlementsRequest; +import com.google.cloud.channel.v1.TransferEntitlementsResponse; +import com.google.cloud.channel.v1.TransferEntitlementsToGoogleRequest; +import com.google.cloud.channel.v1.UnregisterSubscriberRequest; +import com.google.cloud.channel.v1.UnregisterSubscriberResponse; +import com.google.cloud.channel.v1.UpdateChannelPartnerLinkRequest; +import com.google.cloud.channel.v1.UpdateChannelPartnerRepricingConfigRequest; +import com.google.cloud.channel.v1.UpdateCustomerRepricingConfigRequest; +import com.google.cloud.channel.v1.UpdateCustomerRequest; +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 CloudChannelService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonCloudChannelServiceStub extends CloudChannelServiceStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(TransferEntitlementsResponse.getDescriptor()) + .add(Entitlement.getDescriptor()) + .add(Empty.getDescriptor()) + .add(Customer.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + listCustomersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListCustomers") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}/customers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1/{parent=accounts/*/channelPartnerLinks/*}/customers") + .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(ListCustomersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCustomerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/GetCustomer") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setAdditionalPaths("/v1/{name=accounts/*/channelPartnerLinks/*/customers/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Customer.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CheckCloudIdentityAccountsExistRequest, CheckCloudIdentityAccountsExistResponse> + checkCloudIdentityAccountsExistMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/CheckCloudIdentityAccountsExist") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}:checkCloudIdentityAccountsExist", + 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( + CheckCloudIdentityAccountsExistResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCustomerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/CreateCustomer") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}/customers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1/{parent=accounts/*/channelPartnerLinks/*}/customers") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customer", request.getCustomer())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Customer.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCustomerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/UpdateCustomer") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{customer.name=accounts/*/customers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "customer.name", request.getCustomer().getName()); + return fields; + }) + .setAdditionalPaths( + "/v1/{customer.name=accounts/*/channelPartnerLinks/*/customers/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customer", request.getCustomer())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Customer.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteCustomerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/DeleteCustomer") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setAdditionalPaths("/v1/{name=accounts/*/channelPartnerLinks/*/customers/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + importCustomerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ImportCustomer") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}/customers:import", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths( + "/v1/{parent=accounts/*/channelPartnerLinks/*}/customers:import") + .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(Customer.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + provisionCloudIdentityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ProvisionCloudIdentity") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{customer=accounts/*/customers/*}:provisionCloudIdentity", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "customer", request.getCustomer()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearCustomer().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ProvisionCloudIdentityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listEntitlementsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListEntitlements") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*/customers/*}/entitlements", + 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, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListEntitlementsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListTransferableSkusRequest, ListTransferableSkusResponse> + listTransferableSkusMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListTransferableSkus") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}:listTransferableSkus", + 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(ListTransferableSkusResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListTransferableOffersRequest, ListTransferableOffersResponse> + listTransferableOffersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ListTransferableOffers") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}:listTransferableOffers", + 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(ListTransferableOffersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getEntitlementMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/GetEntitlement") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}", + 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(Entitlement.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createEntitlementMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/CreateEntitlement") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*/customers/*}/entitlements", + 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( + (CreateEntitlementRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + changeParametersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ChangeParameters") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:changeParameters", + 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( + (ChangeParametersRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + changeRenewalSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ChangeRenewalSettings") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:changeRenewalSettings", + 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( + (ChangeRenewalSettingsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + changeOfferMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ChangeOffer") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:changeOffer", + 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( + (ChangeOfferRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + startPaidServiceMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/StartPaidService") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:startPaidService", + 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( + (StartPaidServiceRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + suspendEntitlementMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/SuspendEntitlement") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:suspend", + 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( + (SuspendEntitlementRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + cancelEntitlementMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/CancelEntitlement") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:cancel", + 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( + (CancelEntitlementRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + activateEntitlementMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ActivateEntitlement") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/entitlements/*}:activate", + 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( + (ActivateEntitlementRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + transferEntitlementsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/TransferEntitlements") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*/customers/*}:transferEntitlements", + 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( + (TransferEntitlementsRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + transferEntitlementsToGoogleMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/TransferEntitlementsToGoogle") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*/customers/*}:transferEntitlementsToGoogle", + 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( + (TransferEntitlementsToGoogleRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + ListChannelPartnerLinksRequest, ListChannelPartnerLinksResponse> + listChannelPartnerLinksMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ListChannelPartnerLinks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}/channelPartnerLinks", + 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, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListChannelPartnerLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getChannelPartnerLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/GetChannelPartnerLink") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/channelPartnerLinks/*}", + 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(); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ChannelPartnerLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createChannelPartnerLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerLink") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}/channelPartnerLinks", + 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("channelPartnerLink", request.getChannelPartnerLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ChannelPartnerLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateChannelPartnerLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerLink") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/channelPartnerLinks/*}", + 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(ChannelPartnerLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetCustomerRepricingConfigRequest, CustomerRepricingConfig> + getCustomerRepricingConfigMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/GetCustomerRepricingConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/customerRepricingConfigs/*}", + 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(CustomerRepricingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCustomerRepricingConfigsRequest, ListCustomerRepricingConfigsResponse> + listCustomerRepricingConfigsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ListCustomerRepricingConfigs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*/customers/*}/customerRepricingConfigs", + 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(ListCustomerRepricingConfigsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CreateCustomerRepricingConfigRequest, CustomerRepricingConfig> + createCustomerRepricingConfigMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/CreateCustomerRepricingConfig") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*/customers/*}/customerRepricingConfigs", + 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( + "customerRepricingConfig", + request.getCustomerRepricingConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomerRepricingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateCustomerRepricingConfigRequest, CustomerRepricingConfig> + updateCustomerRepricingConfigMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/UpdateCustomerRepricingConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{customerRepricingConfig.name=accounts/*/customers/*/customerRepricingConfigs/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "customerRepricingConfig.name", + request.getCustomerRepricingConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "customerRepricingConfig", + request.getCustomerRepricingConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomerRepricingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteCustomerRepricingConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/DeleteCustomerRepricingConfig") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/customers/*/customerRepricingConfigs/*}", + 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(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetChannelPartnerRepricingConfigRequest, ChannelPartnerRepricingConfig> + getChannelPartnerRepricingConfigMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/GetChannelPartnerRepricingConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=accounts/*/channelPartnerLinks/*/channelPartnerRepricingConfigs/*}", + 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(ChannelPartnerRepricingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListChannelPartnerRepricingConfigsRequest, ListChannelPartnerRepricingConfigsResponse> + listChannelPartnerRepricingConfigsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ListChannelPartnerRepricingConfigs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{parent=accounts/*/channelPartnerLinks/*}/channelPartnerRepricingConfigs", + 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( + ListChannelPartnerRepricingConfigsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CreateChannelPartnerRepricingConfigRequest, ChannelPartnerRepricingConfig> + createChannelPartnerRepricingConfigMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerRepricingConfig") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{parent=accounts/*/channelPartnerLinks/*}/channelPartnerRepricingConfigs", + 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( + "channelPartnerRepricingConfig", + request.getChannelPartnerRepricingConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ChannelPartnerRepricingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateChannelPartnerRepricingConfigRequest, ChannelPartnerRepricingConfig> + updateChannelPartnerRepricingConfigMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerRepricingConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{channelPartnerRepricingConfig.name=accounts/*/channelPartnerLinks/*/channelPartnerRepricingConfigs/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "channelPartnerRepricingConfig.name", + request.getChannelPartnerRepricingConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "channelPartnerRepricingConfig", + request.getChannelPartnerRepricingConfig())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ChannelPartnerRepricingConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteChannelPartnerRepricingConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/DeleteChannelPartnerRepricingConfig") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{name=accounts/*/channelPartnerLinks/*/channelPartnerRepricingConfigs/*}", + 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(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor lookupOfferMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/LookupOffer") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{entitlement=accounts/*/customers/*/entitlements/*}:lookupOffer", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "entitlement", request.getEntitlement()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Offer.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listProductsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListProducts") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/products", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "account", request.getAccount()); + serializer.putQueryParam( + fields, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListProductsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listSkusMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListSkus") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=products/*}/skus", + 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, "account", request.getAccount()); + serializer.putQueryParam( + fields, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListSkusResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listOffersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListOffers") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=accounts/*}/offers", + 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, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListOffersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listPurchasableSkusMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListPurchasableSkus") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{customer=accounts/*/customers/*}:listPurchasableSkus", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "customer", request.getCustomer()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "changeOfferPurchase", request.getChangeOfferPurchase()); + serializer.putQueryParam( + fields, + "createEntitlementPurchase", + request.getCreateEntitlementPurchase()); + serializer.putQueryParam( + fields, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPurchasableSkusResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListPurchasableOffersRequest, ListPurchasableOffersResponse> + listPurchasableOffersMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.channel.v1.CloudChannelService/ListPurchasableOffers") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{customer=accounts/*/customers/*}:listPurchasableOffers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "customer", request.getCustomer()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "changeOfferPurchase", request.getChangeOfferPurchase()); + serializer.putQueryParam( + fields, + "createEntitlementPurchase", + request.getCreateEntitlementPurchase()); + serializer.putQueryParam( + fields, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPurchasableOffersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + registerSubscriberMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/RegisterSubscriber") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{account=accounts/*}:register", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "account", request.getAccount()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAccount().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RegisterSubscriberResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UnregisterSubscriberRequest, UnregisterSubscriberResponse> + unregisterSubscriberMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/UnregisterSubscriber") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{account=accounts/*}:unregister", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "account", request.getAccount()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAccount().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(UnregisterSubscriberResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listSubscribersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.channel.v1.CloudChannelService/ListSubscribers") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{account=accounts/*}:listSubscribers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "account", request.getAccount()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListSubscribersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable listCustomersCallable; + private final UnaryCallable + listCustomersPagedCallable; + private final UnaryCallable getCustomerCallable; + private final UnaryCallable< + CheckCloudIdentityAccountsExistRequest, CheckCloudIdentityAccountsExistResponse> + checkCloudIdentityAccountsExistCallable; + private final UnaryCallable createCustomerCallable; + private final UnaryCallable updateCustomerCallable; + private final UnaryCallable deleteCustomerCallable; + private final UnaryCallable importCustomerCallable; + private final UnaryCallable + provisionCloudIdentityCallable; + private final OperationCallable + provisionCloudIdentityOperationCallable; + private final UnaryCallable + listEntitlementsCallable; + private final UnaryCallable + listEntitlementsPagedCallable; + private final UnaryCallable + listTransferableSkusCallable; + private final UnaryCallable + listTransferableSkusPagedCallable; + private final UnaryCallable + listTransferableOffersCallable; + private final UnaryCallable + listTransferableOffersPagedCallable; + private final UnaryCallable getEntitlementCallable; + private final UnaryCallable createEntitlementCallable; + private final OperationCallable + createEntitlementOperationCallable; + private final UnaryCallable changeParametersCallable; + private final OperationCallable + changeParametersOperationCallable; + private final UnaryCallable + changeRenewalSettingsCallable; + private final OperationCallable + changeRenewalSettingsOperationCallable; + private final UnaryCallable changeOfferCallable; + private final OperationCallable + changeOfferOperationCallable; + private final UnaryCallable startPaidServiceCallable; + private final OperationCallable + startPaidServiceOperationCallable; + private final UnaryCallable suspendEntitlementCallable; + private final OperationCallable + suspendEntitlementOperationCallable; + private final UnaryCallable cancelEntitlementCallable; + private final OperationCallable + cancelEntitlementOperationCallable; + private final UnaryCallable activateEntitlementCallable; + private final OperationCallable + activateEntitlementOperationCallable; + private final UnaryCallable transferEntitlementsCallable; + private final OperationCallable< + TransferEntitlementsRequest, TransferEntitlementsResponse, OperationMetadata> + transferEntitlementsOperationCallable; + private final UnaryCallable + transferEntitlementsToGoogleCallable; + private final OperationCallable + transferEntitlementsToGoogleOperationCallable; + private final UnaryCallable + listChannelPartnerLinksCallable; + private final UnaryCallable + listChannelPartnerLinksPagedCallable; + private final UnaryCallable + getChannelPartnerLinkCallable; + private final UnaryCallable + createChannelPartnerLinkCallable; + private final UnaryCallable + updateChannelPartnerLinkCallable; + private final UnaryCallable + getCustomerRepricingConfigCallable; + private final UnaryCallable< + ListCustomerRepricingConfigsRequest, ListCustomerRepricingConfigsResponse> + listCustomerRepricingConfigsCallable; + private final UnaryCallable< + ListCustomerRepricingConfigsRequest, ListCustomerRepricingConfigsPagedResponse> + listCustomerRepricingConfigsPagedCallable; + private final UnaryCallable + createCustomerRepricingConfigCallable; + private final UnaryCallable + updateCustomerRepricingConfigCallable; + private final UnaryCallable + deleteCustomerRepricingConfigCallable; + private final UnaryCallable< + GetChannelPartnerRepricingConfigRequest, ChannelPartnerRepricingConfig> + getChannelPartnerRepricingConfigCallable; + private final UnaryCallable< + ListChannelPartnerRepricingConfigsRequest, ListChannelPartnerRepricingConfigsResponse> + listChannelPartnerRepricingConfigsCallable; + private final UnaryCallable< + ListChannelPartnerRepricingConfigsRequest, + ListChannelPartnerRepricingConfigsPagedResponse> + listChannelPartnerRepricingConfigsPagedCallable; + private final UnaryCallable< + CreateChannelPartnerRepricingConfigRequest, ChannelPartnerRepricingConfig> + createChannelPartnerRepricingConfigCallable; + private final UnaryCallable< + UpdateChannelPartnerRepricingConfigRequest, ChannelPartnerRepricingConfig> + updateChannelPartnerRepricingConfigCallable; + private final UnaryCallable + deleteChannelPartnerRepricingConfigCallable; + private final UnaryCallable lookupOfferCallable; + private final UnaryCallable listProductsCallable; + private final UnaryCallable + listProductsPagedCallable; + private final UnaryCallable listSkusCallable; + private final UnaryCallable listSkusPagedCallable; + private final UnaryCallable listOffersCallable; + private final UnaryCallable listOffersPagedCallable; + private final UnaryCallable + listPurchasableSkusCallable; + private final UnaryCallable + listPurchasableSkusPagedCallable; + private final UnaryCallable + listPurchasableOffersCallable; + private final UnaryCallable + listPurchasableOffersPagedCallable; + private final UnaryCallable + registerSubscriberCallable; + private final UnaryCallable + unregisterSubscriberCallable; + private final UnaryCallable + listSubscribersCallable; + private final UnaryCallable + listSubscribersPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonCloudChannelServiceStub create( + CloudChannelServiceStubSettings settings) throws IOException { + return new HttpJsonCloudChannelServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonCloudChannelServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonCloudChannelServiceStub( + CloudChannelServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonCloudChannelServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonCloudChannelServiceStub( + CloudChannelServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonCloudChannelServiceStub, 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 HttpJsonCloudChannelServiceStub( + CloudChannelServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonCloudChannelServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonCloudChannelServiceStub, 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 HttpJsonCloudChannelServiceStub( + CloudChannelServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + listCustomersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCustomersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCustomerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCustomerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + CheckCloudIdentityAccountsExistRequest, CheckCloudIdentityAccountsExistResponse> + checkCloudIdentityAccountsExistTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(checkCloudIdentityAccountsExistMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createCustomerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCustomerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateCustomerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCustomerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteCustomerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCustomerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings importCustomerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(importCustomerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + provisionCloudIdentityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(provisionCloudIdentityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listEntitlementsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listEntitlementsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listTransferableSkusTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listTransferableSkusMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listTransferableOffersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listTransferableOffersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getEntitlementTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getEntitlementMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createEntitlementTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createEntitlementMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings changeParametersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(changeParametersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + changeRenewalSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(changeRenewalSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings changeOfferTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(changeOfferMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings startPaidServiceTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(startPaidServiceMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings suspendEntitlementTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(suspendEntitlementMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings cancelEntitlementTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(cancelEntitlementMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + activateEntitlementTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(activateEntitlementMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + transferEntitlementsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferEntitlementsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + transferEntitlementsToGoogleTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(transferEntitlementsToGoogleMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listChannelPartnerLinksTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listChannelPartnerLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getChannelPartnerLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getChannelPartnerLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createChannelPartnerLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createChannelPartnerLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateChannelPartnerLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateChannelPartnerLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCustomerRepricingConfigTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getCustomerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCustomerRepricingConfigsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listCustomerRepricingConfigsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCustomerRepricingConfigTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(createCustomerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCustomerRepricingConfigTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(updateCustomerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteCustomerRepricingConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCustomerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getChannelPartnerRepricingConfigTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(getChannelPartnerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListChannelPartnerRepricingConfigsRequest, ListChannelPartnerRepricingConfigsResponse> + listChannelPartnerRepricingConfigsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listChannelPartnerRepricingConfigsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createChannelPartnerRepricingConfigTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(createChannelPartnerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateChannelPartnerRepricingConfigTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(updateChannelPartnerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteChannelPartnerRepricingConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteChannelPartnerRepricingConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings lookupOfferTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(lookupOfferMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listProductsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listProductsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listSkusTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSkusMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listOffersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listOffersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPurchasableSkusTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listPurchasableSkusMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPurchasableOffersTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listPurchasableOffersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + registerSubscriberTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(registerSubscriberMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + unregisterSubscriberTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(unregisterSubscriberMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listSubscribersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSubscribersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listCustomersCallable = + callableFactory.createUnaryCallable( + listCustomersTransportSettings, settings.listCustomersSettings(), clientContext); + this.listCustomersPagedCallable = + callableFactory.createPagedCallable( + listCustomersTransportSettings, settings.listCustomersSettings(), clientContext); + this.getCustomerCallable = + callableFactory.createUnaryCallable( + getCustomerTransportSettings, settings.getCustomerSettings(), clientContext); + this.checkCloudIdentityAccountsExistCallable = + callableFactory.createUnaryCallable( + checkCloudIdentityAccountsExistTransportSettings, + settings.checkCloudIdentityAccountsExistSettings(), + clientContext); + this.createCustomerCallable = + callableFactory.createUnaryCallable( + createCustomerTransportSettings, settings.createCustomerSettings(), clientContext); + this.updateCustomerCallable = + callableFactory.createUnaryCallable( + updateCustomerTransportSettings, settings.updateCustomerSettings(), clientContext); + this.deleteCustomerCallable = + callableFactory.createUnaryCallable( + deleteCustomerTransportSettings, settings.deleteCustomerSettings(), clientContext); + this.importCustomerCallable = + callableFactory.createUnaryCallable( + importCustomerTransportSettings, settings.importCustomerSettings(), clientContext); + this.provisionCloudIdentityCallable = + callableFactory.createUnaryCallable( + provisionCloudIdentityTransportSettings, + settings.provisionCloudIdentitySettings(), + clientContext); + this.provisionCloudIdentityOperationCallable = + callableFactory.createOperationCallable( + provisionCloudIdentityTransportSettings, + settings.provisionCloudIdentityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listEntitlementsCallable = + callableFactory.createUnaryCallable( + listEntitlementsTransportSettings, settings.listEntitlementsSettings(), clientContext); + this.listEntitlementsPagedCallable = + callableFactory.createPagedCallable( + listEntitlementsTransportSettings, settings.listEntitlementsSettings(), clientContext); + this.listTransferableSkusCallable = + callableFactory.createUnaryCallable( + listTransferableSkusTransportSettings, + settings.listTransferableSkusSettings(), + clientContext); + this.listTransferableSkusPagedCallable = + callableFactory.createPagedCallable( + listTransferableSkusTransportSettings, + settings.listTransferableSkusSettings(), + clientContext); + this.listTransferableOffersCallable = + callableFactory.createUnaryCallable( + listTransferableOffersTransportSettings, + settings.listTransferableOffersSettings(), + clientContext); + this.listTransferableOffersPagedCallable = + callableFactory.createPagedCallable( + listTransferableOffersTransportSettings, + settings.listTransferableOffersSettings(), + clientContext); + this.getEntitlementCallable = + callableFactory.createUnaryCallable( + getEntitlementTransportSettings, settings.getEntitlementSettings(), clientContext); + this.createEntitlementCallable = + callableFactory.createUnaryCallable( + createEntitlementTransportSettings, + settings.createEntitlementSettings(), + clientContext); + this.createEntitlementOperationCallable = + callableFactory.createOperationCallable( + createEntitlementTransportSettings, + settings.createEntitlementOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.changeParametersCallable = + callableFactory.createUnaryCallable( + changeParametersTransportSettings, settings.changeParametersSettings(), clientContext); + this.changeParametersOperationCallable = + callableFactory.createOperationCallable( + changeParametersTransportSettings, + settings.changeParametersOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.changeRenewalSettingsCallable = + callableFactory.createUnaryCallable( + changeRenewalSettingsTransportSettings, + settings.changeRenewalSettingsSettings(), + clientContext); + this.changeRenewalSettingsOperationCallable = + callableFactory.createOperationCallable( + changeRenewalSettingsTransportSettings, + settings.changeRenewalSettingsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.changeOfferCallable = + callableFactory.createUnaryCallable( + changeOfferTransportSettings, settings.changeOfferSettings(), clientContext); + this.changeOfferOperationCallable = + callableFactory.createOperationCallable( + changeOfferTransportSettings, + settings.changeOfferOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.startPaidServiceCallable = + callableFactory.createUnaryCallable( + startPaidServiceTransportSettings, settings.startPaidServiceSettings(), clientContext); + this.startPaidServiceOperationCallable = + callableFactory.createOperationCallable( + startPaidServiceTransportSettings, + settings.startPaidServiceOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.suspendEntitlementCallable = + callableFactory.createUnaryCallable( + suspendEntitlementTransportSettings, + settings.suspendEntitlementSettings(), + clientContext); + this.suspendEntitlementOperationCallable = + callableFactory.createOperationCallable( + suspendEntitlementTransportSettings, + settings.suspendEntitlementOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.cancelEntitlementCallable = + callableFactory.createUnaryCallable( + cancelEntitlementTransportSettings, + settings.cancelEntitlementSettings(), + clientContext); + this.cancelEntitlementOperationCallable = + callableFactory.createOperationCallable( + cancelEntitlementTransportSettings, + settings.cancelEntitlementOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.activateEntitlementCallable = + callableFactory.createUnaryCallable( + activateEntitlementTransportSettings, + settings.activateEntitlementSettings(), + clientContext); + this.activateEntitlementOperationCallable = + callableFactory.createOperationCallable( + activateEntitlementTransportSettings, + settings.activateEntitlementOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.transferEntitlementsCallable = + callableFactory.createUnaryCallable( + transferEntitlementsTransportSettings, + settings.transferEntitlementsSettings(), + clientContext); + this.transferEntitlementsOperationCallable = + callableFactory.createOperationCallable( + transferEntitlementsTransportSettings, + settings.transferEntitlementsOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.transferEntitlementsToGoogleCallable = + callableFactory.createUnaryCallable( + transferEntitlementsToGoogleTransportSettings, + settings.transferEntitlementsToGoogleSettings(), + clientContext); + this.transferEntitlementsToGoogleOperationCallable = + callableFactory.createOperationCallable( + transferEntitlementsToGoogleTransportSettings, + settings.transferEntitlementsToGoogleOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listChannelPartnerLinksCallable = + callableFactory.createUnaryCallable( + listChannelPartnerLinksTransportSettings, + settings.listChannelPartnerLinksSettings(), + clientContext); + this.listChannelPartnerLinksPagedCallable = + callableFactory.createPagedCallable( + listChannelPartnerLinksTransportSettings, + settings.listChannelPartnerLinksSettings(), + clientContext); + this.getChannelPartnerLinkCallable = + callableFactory.createUnaryCallable( + getChannelPartnerLinkTransportSettings, + settings.getChannelPartnerLinkSettings(), + clientContext); + this.createChannelPartnerLinkCallable = + callableFactory.createUnaryCallable( + createChannelPartnerLinkTransportSettings, + settings.createChannelPartnerLinkSettings(), + clientContext); + this.updateChannelPartnerLinkCallable = + callableFactory.createUnaryCallable( + updateChannelPartnerLinkTransportSettings, + settings.updateChannelPartnerLinkSettings(), + clientContext); + this.getCustomerRepricingConfigCallable = + callableFactory.createUnaryCallable( + getCustomerRepricingConfigTransportSettings, + settings.getCustomerRepricingConfigSettings(), + clientContext); + this.listCustomerRepricingConfigsCallable = + callableFactory.createUnaryCallable( + listCustomerRepricingConfigsTransportSettings, + settings.listCustomerRepricingConfigsSettings(), + clientContext); + this.listCustomerRepricingConfigsPagedCallable = + callableFactory.createPagedCallable( + listCustomerRepricingConfigsTransportSettings, + settings.listCustomerRepricingConfigsSettings(), + clientContext); + this.createCustomerRepricingConfigCallable = + callableFactory.createUnaryCallable( + createCustomerRepricingConfigTransportSettings, + settings.createCustomerRepricingConfigSettings(), + clientContext); + this.updateCustomerRepricingConfigCallable = + callableFactory.createUnaryCallable( + updateCustomerRepricingConfigTransportSettings, + settings.updateCustomerRepricingConfigSettings(), + clientContext); + this.deleteCustomerRepricingConfigCallable = + callableFactory.createUnaryCallable( + deleteCustomerRepricingConfigTransportSettings, + settings.deleteCustomerRepricingConfigSettings(), + clientContext); + this.getChannelPartnerRepricingConfigCallable = + callableFactory.createUnaryCallable( + getChannelPartnerRepricingConfigTransportSettings, + settings.getChannelPartnerRepricingConfigSettings(), + clientContext); + this.listChannelPartnerRepricingConfigsCallable = + callableFactory.createUnaryCallable( + listChannelPartnerRepricingConfigsTransportSettings, + settings.listChannelPartnerRepricingConfigsSettings(), + clientContext); + this.listChannelPartnerRepricingConfigsPagedCallable = + callableFactory.createPagedCallable( + listChannelPartnerRepricingConfigsTransportSettings, + settings.listChannelPartnerRepricingConfigsSettings(), + clientContext); + this.createChannelPartnerRepricingConfigCallable = + callableFactory.createUnaryCallable( + createChannelPartnerRepricingConfigTransportSettings, + settings.createChannelPartnerRepricingConfigSettings(), + clientContext); + this.updateChannelPartnerRepricingConfigCallable = + callableFactory.createUnaryCallable( + updateChannelPartnerRepricingConfigTransportSettings, + settings.updateChannelPartnerRepricingConfigSettings(), + clientContext); + this.deleteChannelPartnerRepricingConfigCallable = + callableFactory.createUnaryCallable( + deleteChannelPartnerRepricingConfigTransportSettings, + settings.deleteChannelPartnerRepricingConfigSettings(), + clientContext); + this.lookupOfferCallable = + callableFactory.createUnaryCallable( + lookupOfferTransportSettings, settings.lookupOfferSettings(), clientContext); + this.listProductsCallable = + callableFactory.createUnaryCallable( + listProductsTransportSettings, settings.listProductsSettings(), clientContext); + this.listProductsPagedCallable = + callableFactory.createPagedCallable( + listProductsTransportSettings, settings.listProductsSettings(), clientContext); + this.listSkusCallable = + callableFactory.createUnaryCallable( + listSkusTransportSettings, settings.listSkusSettings(), clientContext); + this.listSkusPagedCallable = + callableFactory.createPagedCallable( + listSkusTransportSettings, settings.listSkusSettings(), clientContext); + this.listOffersCallable = + callableFactory.createUnaryCallable( + listOffersTransportSettings, settings.listOffersSettings(), clientContext); + this.listOffersPagedCallable = + callableFactory.createPagedCallable( + listOffersTransportSettings, settings.listOffersSettings(), clientContext); + this.listPurchasableSkusCallable = + callableFactory.createUnaryCallable( + listPurchasableSkusTransportSettings, + settings.listPurchasableSkusSettings(), + clientContext); + this.listPurchasableSkusPagedCallable = + callableFactory.createPagedCallable( + listPurchasableSkusTransportSettings, + settings.listPurchasableSkusSettings(), + clientContext); + this.listPurchasableOffersCallable = + callableFactory.createUnaryCallable( + listPurchasableOffersTransportSettings, + settings.listPurchasableOffersSettings(), + clientContext); + this.listPurchasableOffersPagedCallable = + callableFactory.createPagedCallable( + listPurchasableOffersTransportSettings, + settings.listPurchasableOffersSettings(), + clientContext); + this.registerSubscriberCallable = + callableFactory.createUnaryCallable( + registerSubscriberTransportSettings, + settings.registerSubscriberSettings(), + clientContext); + this.unregisterSubscriberCallable = + callableFactory.createUnaryCallable( + unregisterSubscriberTransportSettings, + settings.unregisterSubscriberSettings(), + clientContext); + this.listSubscribersCallable = + callableFactory.createUnaryCallable( + listSubscribersTransportSettings, settings.listSubscribersSettings(), clientContext); + this.listSubscribersPagedCallable = + callableFactory.createPagedCallable( + listSubscribersTransportSettings, settings.listSubscribersSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listCustomersMethodDescriptor); + methodDescriptors.add(getCustomerMethodDescriptor); + methodDescriptors.add(checkCloudIdentityAccountsExistMethodDescriptor); + methodDescriptors.add(createCustomerMethodDescriptor); + methodDescriptors.add(updateCustomerMethodDescriptor); + methodDescriptors.add(deleteCustomerMethodDescriptor); + methodDescriptors.add(importCustomerMethodDescriptor); + methodDescriptors.add(provisionCloudIdentityMethodDescriptor); + methodDescriptors.add(listEntitlementsMethodDescriptor); + methodDescriptors.add(listTransferableSkusMethodDescriptor); + methodDescriptors.add(listTransferableOffersMethodDescriptor); + methodDescriptors.add(getEntitlementMethodDescriptor); + methodDescriptors.add(createEntitlementMethodDescriptor); + methodDescriptors.add(changeParametersMethodDescriptor); + methodDescriptors.add(changeRenewalSettingsMethodDescriptor); + methodDescriptors.add(changeOfferMethodDescriptor); + methodDescriptors.add(startPaidServiceMethodDescriptor); + methodDescriptors.add(suspendEntitlementMethodDescriptor); + methodDescriptors.add(cancelEntitlementMethodDescriptor); + methodDescriptors.add(activateEntitlementMethodDescriptor); + methodDescriptors.add(transferEntitlementsMethodDescriptor); + methodDescriptors.add(transferEntitlementsToGoogleMethodDescriptor); + methodDescriptors.add(listChannelPartnerLinksMethodDescriptor); + methodDescriptors.add(getChannelPartnerLinkMethodDescriptor); + methodDescriptors.add(createChannelPartnerLinkMethodDescriptor); + methodDescriptors.add(updateChannelPartnerLinkMethodDescriptor); + methodDescriptors.add(getCustomerRepricingConfigMethodDescriptor); + methodDescriptors.add(listCustomerRepricingConfigsMethodDescriptor); + methodDescriptors.add(createCustomerRepricingConfigMethodDescriptor); + methodDescriptors.add(updateCustomerRepricingConfigMethodDescriptor); + methodDescriptors.add(deleteCustomerRepricingConfigMethodDescriptor); + methodDescriptors.add(getChannelPartnerRepricingConfigMethodDescriptor); + methodDescriptors.add(listChannelPartnerRepricingConfigsMethodDescriptor); + methodDescriptors.add(createChannelPartnerRepricingConfigMethodDescriptor); + methodDescriptors.add(updateChannelPartnerRepricingConfigMethodDescriptor); + methodDescriptors.add(deleteChannelPartnerRepricingConfigMethodDescriptor); + methodDescriptors.add(lookupOfferMethodDescriptor); + methodDescriptors.add(listProductsMethodDescriptor); + methodDescriptors.add(listSkusMethodDescriptor); + methodDescriptors.add(listOffersMethodDescriptor); + methodDescriptors.add(listPurchasableSkusMethodDescriptor); + methodDescriptors.add(listPurchasableOffersMethodDescriptor); + methodDescriptors.add(registerSubscriberMethodDescriptor); + methodDescriptors.add(unregisterSubscriberMethodDescriptor); + methodDescriptors.add(listSubscribersMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable listCustomersCallable() { + return listCustomersCallable; + } + + @Override + public UnaryCallable + listCustomersPagedCallable() { + return listCustomersPagedCallable; + } + + @Override + public UnaryCallable getCustomerCallable() { + return getCustomerCallable; + } + + @Override + public UnaryCallable< + CheckCloudIdentityAccountsExistRequest, CheckCloudIdentityAccountsExistResponse> + checkCloudIdentityAccountsExistCallable() { + return checkCloudIdentityAccountsExistCallable; + } + + @Override + public UnaryCallable createCustomerCallable() { + return createCustomerCallable; + } + + @Override + public UnaryCallable updateCustomerCallable() { + return updateCustomerCallable; + } + + @Override + public UnaryCallable deleteCustomerCallable() { + return deleteCustomerCallable; + } + + @Override + public UnaryCallable importCustomerCallable() { + return importCustomerCallable; + } + + @Override + public UnaryCallable provisionCloudIdentityCallable() { + return provisionCloudIdentityCallable; + } + + @Override + public OperationCallable + provisionCloudIdentityOperationCallable() { + return provisionCloudIdentityOperationCallable; + } + + @Override + public UnaryCallable + listEntitlementsCallable() { + return listEntitlementsCallable; + } + + @Override + public UnaryCallable + listEntitlementsPagedCallable() { + return listEntitlementsPagedCallable; + } + + @Override + public UnaryCallable + listTransferableSkusCallable() { + return listTransferableSkusCallable; + } + + @Override + public UnaryCallable + listTransferableSkusPagedCallable() { + return listTransferableSkusPagedCallable; + } + + @Override + public UnaryCallable + listTransferableOffersCallable() { + return listTransferableOffersCallable; + } + + @Override + public UnaryCallable + listTransferableOffersPagedCallable() { + return listTransferableOffersPagedCallable; + } + + @Override + public UnaryCallable getEntitlementCallable() { + return getEntitlementCallable; + } + + @Override + public UnaryCallable createEntitlementCallable() { + return createEntitlementCallable; + } + + @Override + public OperationCallable + createEntitlementOperationCallable() { + return createEntitlementOperationCallable; + } + + @Override + public UnaryCallable changeParametersCallable() { + return changeParametersCallable; + } + + @Override + public OperationCallable + changeParametersOperationCallable() { + return changeParametersOperationCallable; + } + + @Override + public UnaryCallable changeRenewalSettingsCallable() { + return changeRenewalSettingsCallable; + } + + @Override + public OperationCallable + changeRenewalSettingsOperationCallable() { + return changeRenewalSettingsOperationCallable; + } + + @Override + public UnaryCallable changeOfferCallable() { + return changeOfferCallable; + } + + @Override + public OperationCallable + changeOfferOperationCallable() { + return changeOfferOperationCallable; + } + + @Override + public UnaryCallable startPaidServiceCallable() { + return startPaidServiceCallable; + } + + @Override + public OperationCallable + startPaidServiceOperationCallable() { + return startPaidServiceOperationCallable; + } + + @Override + public UnaryCallable suspendEntitlementCallable() { + return suspendEntitlementCallable; + } + + @Override + public OperationCallable + suspendEntitlementOperationCallable() { + return suspendEntitlementOperationCallable; + } + + @Override + public UnaryCallable cancelEntitlementCallable() { + return cancelEntitlementCallable; + } + + @Override + public OperationCallable + cancelEntitlementOperationCallable() { + return cancelEntitlementOperationCallable; + } + + @Override + public UnaryCallable activateEntitlementCallable() { + return activateEntitlementCallable; + } + + @Override + public OperationCallable + activateEntitlementOperationCallable() { + return activateEntitlementOperationCallable; + } + + @Override + public UnaryCallable transferEntitlementsCallable() { + return transferEntitlementsCallable; + } + + @Override + public OperationCallable< + TransferEntitlementsRequest, TransferEntitlementsResponse, OperationMetadata> + transferEntitlementsOperationCallable() { + return transferEntitlementsOperationCallable; + } + + @Override + public UnaryCallable + transferEntitlementsToGoogleCallable() { + return transferEntitlementsToGoogleCallable; + } + + @Override + public OperationCallable + transferEntitlementsToGoogleOperationCallable() { + return transferEntitlementsToGoogleOperationCallable; + } + + @Override + public UnaryCallable + listChannelPartnerLinksCallable() { + return listChannelPartnerLinksCallable; + } + + @Override + public UnaryCallable + listChannelPartnerLinksPagedCallable() { + return listChannelPartnerLinksPagedCallable; + } + + @Override + public UnaryCallable + getChannelPartnerLinkCallable() { + return getChannelPartnerLinkCallable; + } + + @Override + public UnaryCallable + createChannelPartnerLinkCallable() { + return createChannelPartnerLinkCallable; + } + + @Override + public UnaryCallable + updateChannelPartnerLinkCallable() { + return updateChannelPartnerLinkCallable; + } + + @Override + public UnaryCallable + getCustomerRepricingConfigCallable() { + return getCustomerRepricingConfigCallable; + } + + @Override + public UnaryCallable + listCustomerRepricingConfigsCallable() { + return listCustomerRepricingConfigsCallable; + } + + @Override + public UnaryCallable< + ListCustomerRepricingConfigsRequest, ListCustomerRepricingConfigsPagedResponse> + listCustomerRepricingConfigsPagedCallable() { + return listCustomerRepricingConfigsPagedCallable; + } + + @Override + public UnaryCallable + createCustomerRepricingConfigCallable() { + return createCustomerRepricingConfigCallable; + } + + @Override + public UnaryCallable + updateCustomerRepricingConfigCallable() { + return updateCustomerRepricingConfigCallable; + } + + @Override + public UnaryCallable + deleteCustomerRepricingConfigCallable() { + return deleteCustomerRepricingConfigCallable; + } + + @Override + public UnaryCallable + getChannelPartnerRepricingConfigCallable() { + return getChannelPartnerRepricingConfigCallable; + } + + @Override + public UnaryCallable< + ListChannelPartnerRepricingConfigsRequest, ListChannelPartnerRepricingConfigsResponse> + listChannelPartnerRepricingConfigsCallable() { + return listChannelPartnerRepricingConfigsCallable; + } + + @Override + public UnaryCallable< + ListChannelPartnerRepricingConfigsRequest, + ListChannelPartnerRepricingConfigsPagedResponse> + listChannelPartnerRepricingConfigsPagedCallable() { + return listChannelPartnerRepricingConfigsPagedCallable; + } + + @Override + public UnaryCallable + createChannelPartnerRepricingConfigCallable() { + return createChannelPartnerRepricingConfigCallable; + } + + @Override + public UnaryCallable + updateChannelPartnerRepricingConfigCallable() { + return updateChannelPartnerRepricingConfigCallable; + } + + @Override + public UnaryCallable + deleteChannelPartnerRepricingConfigCallable() { + return deleteChannelPartnerRepricingConfigCallable; + } + + @Override + public UnaryCallable lookupOfferCallable() { + return lookupOfferCallable; + } + + @Override + public UnaryCallable listProductsCallable() { + return listProductsCallable; + } + + @Override + public UnaryCallable listProductsPagedCallable() { + return listProductsPagedCallable; + } + + @Override + public UnaryCallable listSkusCallable() { + return listSkusCallable; + } + + @Override + public UnaryCallable listSkusPagedCallable() { + return listSkusPagedCallable; + } + + @Override + public UnaryCallable listOffersCallable() { + return listOffersCallable; + } + + @Override + public UnaryCallable listOffersPagedCallable() { + return listOffersPagedCallable; + } + + @Override + public UnaryCallable + listPurchasableSkusCallable() { + return listPurchasableSkusCallable; + } + + @Override + public UnaryCallable + listPurchasableSkusPagedCallable() { + return listPurchasableSkusPagedCallable; + } + + @Override + public UnaryCallable + listPurchasableOffersCallable() { + return listPurchasableOffersCallable; + } + + @Override + public UnaryCallable + listPurchasableOffersPagedCallable() { + return listPurchasableOffersPagedCallable; + } + + @Override + public UnaryCallable + registerSubscriberCallable() { + return registerSubscriberCallable; + } + + @Override + public UnaryCallable + unregisterSubscriberCallable() { + return unregisterSubscriberCallable; + } + + @Override + public UnaryCallable listSubscribersCallable() { + return listSubscribersCallable; + } + + @Override + public UnaryCallable + listSubscribersPagedCallable() { + return listSubscribersPagedCallable; + } + + @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/google-cloud-channel/src/test/java/com/google/cloud/channel/v1/CloudChannelServiceClientHttpJsonTest.java b/google-cloud-channel/src/test/java/com/google/cloud/channel/v1/CloudChannelServiceClientHttpJsonTest.java new file mode 100644 index 00000000..2f6bc6c7 --- /dev/null +++ b/google-cloud-channel/src/test/java/com/google/cloud/channel/v1/CloudChannelServiceClientHttpJsonTest.java @@ -0,0 +1,3318 @@ +/* + * 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.channel.v1; + +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListChannelPartnerLinksPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListChannelPartnerRepricingConfigsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListCustomerRepricingConfigsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListCustomersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListEntitlementsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListOffersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListProductsPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListPurchasableOffersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListPurchasableSkusPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListSkusPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListSubscribersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListTransferableOffersPagedResponse; +import static com.google.cloud.channel.v1.CloudChannelServiceClient.ListTransferableSkusPagedResponse; + +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.channel.v1.stub.HttpJsonCloudChannelServiceStub; +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.PostalAddress; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +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 CloudChannelServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static CloudChannelServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonCloudChannelServiceStub.getMethodDescriptors(), + CloudChannelServiceSettings.getDefaultEndpoint()); + CloudChannelServiceSettings settings = + CloudChannelServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + CloudChannelServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CloudChannelServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void listCustomersTest() throws Exception { + Customer responsesElement = Customer.newBuilder().build(); + ListCustomersResponse expectedResponse = + ListCustomersResponse.newBuilder() + .setNextPageToken("") + .addAllCustomers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListCustomersRequest request = + ListCustomersRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + + ListCustomersPagedResponse pagedListResponse = client.listCustomers(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomersList().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 listCustomersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListCustomersRequest request = + ListCustomersRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + client.listCustomers(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomerTest() throws Exception { + Customer expectedResponse = + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build(); + mockService.addResponse(expectedResponse); + + CustomerName name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + + Customer actualResponse = client.getCustomer(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 getCustomerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerName name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + client.getCustomer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomerTest2() throws Exception { + Customer expectedResponse = + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-2707/customers/customer-2707"; + + Customer actualResponse = client.getCustomer(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 getCustomerExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-2707/customers/customer-2707"; + client.getCustomer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void checkCloudIdentityAccountsExistTest() throws Exception { + CheckCloudIdentityAccountsExistResponse expectedResponse = + CheckCloudIdentityAccountsExistResponse.newBuilder() + .addAllCloudIdentityAccounts(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CheckCloudIdentityAccountsExistRequest request = + CheckCloudIdentityAccountsExistRequest.newBuilder() + .setParent("accounts/account-4811") + .setDomain("domain-1326197564") + .build(); + + CheckCloudIdentityAccountsExistResponse actualResponse = + client.checkCloudIdentityAccountsExist(request); + 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 checkCloudIdentityAccountsExistExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CheckCloudIdentityAccountsExistRequest request = + CheckCloudIdentityAccountsExistRequest.newBuilder() + .setParent("accounts/account-4811") + .setDomain("domain-1326197564") + .build(); + client.checkCloudIdentityAccountsExist(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomerTest() throws Exception { + Customer expectedResponse = + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build(); + mockService.addResponse(expectedResponse); + + CreateCustomerRequest request = + CreateCustomerRequest.newBuilder() + .setParent("accounts/account-4811") + .setCustomer(Customer.newBuilder().build()) + .build(); + + Customer actualResponse = client.createCustomer(request); + 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 createCustomerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CreateCustomerRequest request = + CreateCustomerRequest.newBuilder() + .setParent("accounts/account-4811") + .setCustomer(Customer.newBuilder().build()) + .build(); + client.createCustomer(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCustomerTest() throws Exception { + Customer expectedResponse = + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build(); + mockService.addResponse(expectedResponse); + + UpdateCustomerRequest request = + UpdateCustomerRequest.newBuilder() + .setCustomer( + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Customer actualResponse = client.updateCustomer(request); + 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 updateCustomerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UpdateCustomerRequest request = + UpdateCustomerRequest.newBuilder() + .setCustomer( + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.updateCustomer(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteCustomerTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + CustomerName name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + + client.deleteCustomer(name); + + 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 deleteCustomerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerName name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + client.deleteCustomer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteCustomerTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-2707/customers/customer-2707"; + + client.deleteCustomer(name); + + 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 deleteCustomerExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-2707/customers/customer-2707"; + client.deleteCustomer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void importCustomerTest() throws Exception { + Customer expectedResponse = + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build(); + mockService.addResponse(expectedResponse); + + ImportCustomerRequest request = + ImportCustomerRequest.newBuilder() + .setParent("accounts/account-4811") + .setAuthToken("authToken1450587441") + .setOverwriteIfExists(true) + .setChannelPartnerId("channelPartnerId-170366400") + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + + Customer actualResponse = client.importCustomer(request); + 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 importCustomerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ImportCustomerRequest request = + ImportCustomerRequest.newBuilder() + .setParent("accounts/account-4811") + .setAuthToken("authToken1450587441") + .setOverwriteIfExists(true) + .setChannelPartnerId("channelPartnerId-170366400") + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + client.importCustomer(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void provisionCloudIdentityTest() throws Exception { + Customer expectedResponse = + Customer.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setOrgDisplayName("orgDisplayName127031529") + .setOrgPostalAddress(PostalAddress.newBuilder().build()) + .setPrimaryContactInfo(ContactInfo.newBuilder().build()) + .setAlternateEmail("alternateEmail-232564926") + .setDomain("domain-1326197564") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCloudIdentityId("cloudIdentityId941784718") + .setLanguageCode("languageCode-2092349083") + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setChannelPartnerId("channelPartnerId-170366400") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("provisionCloudIdentityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ProvisionCloudIdentityRequest request = + ProvisionCloudIdentityRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setUser(AdminUser.newBuilder().build()) + .setValidateOnly(true) + .build(); + + Customer actualResponse = client.provisionCloudIdentityAsync(request).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 provisionCloudIdentityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProvisionCloudIdentityRequest request = + ProvisionCloudIdentityRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setUser(AdminUser.newBuilder().build()) + .setValidateOnly(true) + .build(); + client.provisionCloudIdentityAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listEntitlementsTest() throws Exception { + Entitlement responsesElement = Entitlement.newBuilder().build(); + ListEntitlementsResponse expectedResponse = + ListEntitlementsResponse.newBuilder() + .setNextPageToken("") + .addAllEntitlements(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListEntitlementsRequest request = + ListEntitlementsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListEntitlementsPagedResponse pagedListResponse = client.listEntitlements(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getEntitlementsList().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 listEntitlementsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListEntitlementsRequest request = + ListEntitlementsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listEntitlements(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTransferableSkusTest() throws Exception { + TransferableSku responsesElement = TransferableSku.newBuilder().build(); + ListTransferableSkusResponse expectedResponse = + ListTransferableSkusResponse.newBuilder() + .setNextPageToken("") + .addAllTransferableSkus(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListTransferableSkusRequest request = + ListTransferableSkusRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setAuthToken("authToken1450587441") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListTransferableSkusPagedResponse pagedListResponse = client.listTransferableSkus(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTransferableSkusList().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 listTransferableSkusExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListTransferableSkusRequest request = + ListTransferableSkusRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setAuthToken("authToken1450587441") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listTransferableSkus(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTransferableOffersTest() throws Exception { + TransferableOffer responsesElement = TransferableOffer.newBuilder().build(); + ListTransferableOffersResponse expectedResponse = + ListTransferableOffersResponse.newBuilder() + .setNextPageToken("") + .addAllTransferableOffers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListTransferableOffersRequest request = + ListTransferableOffersRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setSku("sku113949") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListTransferableOffersPagedResponse pagedListResponse = client.listTransferableOffers(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTransferableOffersList().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 listTransferableOffersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListTransferableOffersRequest request = + ListTransferableOffersRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setSku("sku113949") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listTransferableOffers(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getEntitlementTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + GetEntitlementRequest request = + GetEntitlementRequest.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + + Entitlement actualResponse = client.getEntitlement(request); + 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 getEntitlementExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetEntitlementRequest request = + GetEntitlementRequest.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + client.getEntitlement(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createEntitlementTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createEntitlementTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CreateEntitlementRequest request = + CreateEntitlementRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setEntitlement(Entitlement.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + + Entitlement actualResponse = client.createEntitlementAsync(request).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 createEntitlementExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CreateEntitlementRequest request = + CreateEntitlementRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setEntitlement(Entitlement.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + client.createEntitlementAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void changeParametersTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("changeParametersTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ChangeParametersRequest request = + ChangeParametersRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .addAllParameters(new ArrayList()) + .setRequestId("requestId693933066") + .setPurchaseOrderId("purchaseOrderId2029917384") + .build(); + + Entitlement actualResponse = client.changeParametersAsync(request).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 changeParametersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChangeParametersRequest request = + ChangeParametersRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .addAllParameters(new ArrayList()) + .setRequestId("requestId693933066") + .setPurchaseOrderId("purchaseOrderId2029917384") + .build(); + client.changeParametersAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void changeRenewalSettingsTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("changeRenewalSettingsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ChangeRenewalSettingsRequest request = + ChangeRenewalSettingsRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRenewalSettings(RenewalSettings.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + + Entitlement actualResponse = client.changeRenewalSettingsAsync(request).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 changeRenewalSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChangeRenewalSettingsRequest request = + ChangeRenewalSettingsRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRenewalSettings(RenewalSettings.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + client.changeRenewalSettingsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void changeOfferTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("changeOfferTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ChangeOfferRequest request = + ChangeOfferRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .addAllParameters(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setRequestId("requestId693933066") + .build(); + + Entitlement actualResponse = client.changeOfferAsync(request).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 changeOfferExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChangeOfferRequest request = + ChangeOfferRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .addAllParameters(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setRequestId("requestId693933066") + .build(); + client.changeOfferAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void startPaidServiceTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("startPaidServiceTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + StartPaidServiceRequest request = + StartPaidServiceRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + + Entitlement actualResponse = client.startPaidServiceAsync(request).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 startPaidServiceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + StartPaidServiceRequest request = + StartPaidServiceRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + client.startPaidServiceAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void suspendEntitlementTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("suspendEntitlementTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + SuspendEntitlementRequest request = + SuspendEntitlementRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + + Entitlement actualResponse = client.suspendEntitlementAsync(request).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 suspendEntitlementExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SuspendEntitlementRequest request = + SuspendEntitlementRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + client.suspendEntitlementAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void cancelEntitlementTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("cancelEntitlementTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CancelEntitlementRequest request = + CancelEntitlementRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + + client.cancelEntitlementAsync(request).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 cancelEntitlementExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CancelEntitlementRequest request = + CancelEntitlementRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + client.cancelEntitlementAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void activateEntitlementTest() throws Exception { + Entitlement expectedResponse = + Entitlement.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setCommitmentSettings(CommitmentSettings.newBuilder().build()) + .setProvisionedService(ProvisionedService.newBuilder().build()) + .addAllSuspensionReasons(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setTrialSettings(TrialSettings.newBuilder().build()) + .setAssociationInfo(AssociationInfo.newBuilder().build()) + .addAllParameters(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("activateEntitlementTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ActivateEntitlementRequest request = + ActivateEntitlementRequest.newBuilder() + .setName("accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + + Entitlement actualResponse = client.activateEntitlementAsync(request).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 activateEntitlementExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ActivateEntitlementRequest request = + ActivateEntitlementRequest.newBuilder() + .setName( + "accounts/account-6419/customers/customer-6419/entitlements/entitlement-6419") + .setRequestId("requestId693933066") + .build(); + client.activateEntitlementAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferEntitlementsTest() throws Exception { + TransferEntitlementsResponse expectedResponse = + TransferEntitlementsResponse.newBuilder() + .addAllEntitlements(new ArrayList()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferEntitlementsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + TransferEntitlementsRequest request = + TransferEntitlementsRequest.newBuilder() + .setParent("accounts/account-2188/customers/customer-2188") + .addAllEntitlements(new ArrayList()) + .setAuthToken("authToken1450587441") + .setRequestId("requestId693933066") + .build(); + + TransferEntitlementsResponse actualResponse = client.transferEntitlementsAsync(request).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 transferEntitlementsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TransferEntitlementsRequest request = + TransferEntitlementsRequest.newBuilder() + .setParent("accounts/account-2188/customers/customer-2188") + .addAllEntitlements(new ArrayList()) + .setAuthToken("authToken1450587441") + .setRequestId("requestId693933066") + .build(); + client.transferEntitlementsAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void transferEntitlementsToGoogleTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("transferEntitlementsToGoogleTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + TransferEntitlementsToGoogleRequest request = + TransferEntitlementsToGoogleRequest.newBuilder() + .setParent("accounts/account-2188/customers/customer-2188") + .addAllEntitlements(new ArrayList()) + .setRequestId("requestId693933066") + .build(); + + client.transferEntitlementsToGoogleAsync(request).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 transferEntitlementsToGoogleExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TransferEntitlementsToGoogleRequest request = + TransferEntitlementsToGoogleRequest.newBuilder() + .setParent("accounts/account-2188/customers/customer-2188") + .addAllEntitlements(new ArrayList()) + .setRequestId("requestId693933066") + .build(); + client.transferEntitlementsToGoogleAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listChannelPartnerLinksTest() throws Exception { + ChannelPartnerLink responsesElement = ChannelPartnerLink.newBuilder().build(); + ListChannelPartnerLinksResponse expectedResponse = + ListChannelPartnerLinksResponse.newBuilder() + .setNextPageToken("") + .addAllChannelPartnerLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListChannelPartnerLinksRequest request = + ListChannelPartnerLinksRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + + ListChannelPartnerLinksPagedResponse pagedListResponse = + client.listChannelPartnerLinks(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getChannelPartnerLinksList().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 listChannelPartnerLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListChannelPartnerLinksRequest request = + ListChannelPartnerLinksRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + client.listChannelPartnerLinks(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getChannelPartnerLinkTest() throws Exception { + ChannelPartnerLink expectedResponse = + ChannelPartnerLink.newBuilder() + .setName(ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setResellerCloudIdentityId("resellerCloudIdentityId478410940") + .setLinkState(ChannelPartnerLinkState.forNumber(0)) + .setInviteLinkUri("inviteLinkUri-1908670519") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setPublicId("publicId1293600100") + .setChannelPartnerCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetChannelPartnerLinkRequest request = + GetChannelPartnerLinkRequest.newBuilder() + .setName("accounts/account-9420/channelPartnerLinks/channelPartnerLink-9420") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + + ChannelPartnerLink actualResponse = client.getChannelPartnerLink(request); + 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 getChannelPartnerLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetChannelPartnerLinkRequest request = + GetChannelPartnerLinkRequest.newBuilder() + .setName("accounts/account-9420/channelPartnerLinks/channelPartnerLink-9420") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + client.getChannelPartnerLink(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createChannelPartnerLinkTest() throws Exception { + ChannelPartnerLink expectedResponse = + ChannelPartnerLink.newBuilder() + .setName(ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setResellerCloudIdentityId("resellerCloudIdentityId478410940") + .setLinkState(ChannelPartnerLinkState.forNumber(0)) + .setInviteLinkUri("inviteLinkUri-1908670519") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setPublicId("publicId1293600100") + .setChannelPartnerCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + CreateChannelPartnerLinkRequest request = + CreateChannelPartnerLinkRequest.newBuilder() + .setParent("accounts/account-4811") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .build(); + + ChannelPartnerLink actualResponse = client.createChannelPartnerLink(request); + 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 createChannelPartnerLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CreateChannelPartnerLinkRequest request = + CreateChannelPartnerLinkRequest.newBuilder() + .setParent("accounts/account-4811") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .build(); + client.createChannelPartnerLink(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateChannelPartnerLinkTest() throws Exception { + ChannelPartnerLink expectedResponse = + ChannelPartnerLink.newBuilder() + .setName(ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setResellerCloudIdentityId("resellerCloudIdentityId478410940") + .setLinkState(ChannelPartnerLinkState.forNumber(0)) + .setInviteLinkUri("inviteLinkUri-1908670519") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setPublicId("publicId1293600100") + .setChannelPartnerCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + UpdateChannelPartnerLinkRequest request = + UpdateChannelPartnerLinkRequest.newBuilder() + .setName("accounts/account-9420/channelPartnerLinks/channelPartnerLink-9420") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + ChannelPartnerLink actualResponse = client.updateChannelPartnerLink(request); + 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 updateChannelPartnerLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UpdateChannelPartnerLinkRequest request = + UpdateChannelPartnerLinkRequest.newBuilder() + .setName("accounts/account-9420/channelPartnerLinks/channelPartnerLink-9420") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.updateChannelPartnerLink(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomerRepricingConfigTest() throws Exception { + CustomerRepricingConfig expectedResponse = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + CustomerRepricingConfigName name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]"); + + CustomerRepricingConfig actualResponse = client.getCustomerRepricingConfig(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 getCustomerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerRepricingConfigName name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]"); + client.getCustomerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomerRepricingConfigTest2() throws Exception { + CustomerRepricingConfig expectedResponse = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "accounts/account-6999/customers/customer-6999/customerRepricingConfigs/customerRepricingConfig-6999"; + + CustomerRepricingConfig actualResponse = client.getCustomerRepricingConfig(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 getCustomerRepricingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "accounts/account-6999/customers/customer-6999/customerRepricingConfigs/customerRepricingConfig-6999"; + client.getCustomerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomerRepricingConfigsTest() throws Exception { + CustomerRepricingConfig responsesElement = CustomerRepricingConfig.newBuilder().build(); + ListCustomerRepricingConfigsResponse expectedResponse = + ListCustomerRepricingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllCustomerRepricingConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CustomerName parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + + ListCustomerRepricingConfigsPagedResponse pagedListResponse = + client.listCustomerRepricingConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getCustomerRepricingConfigsList().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 listCustomerRepricingConfigsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerName parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + client.listCustomerRepricingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomerRepricingConfigsTest2() throws Exception { + CustomerRepricingConfig responsesElement = CustomerRepricingConfig.newBuilder().build(); + ListCustomerRepricingConfigsResponse expectedResponse = + ListCustomerRepricingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllCustomerRepricingConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "accounts/account-2188/customers/customer-2188"; + + ListCustomerRepricingConfigsPagedResponse pagedListResponse = + client.listCustomerRepricingConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getCustomerRepricingConfigsList().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 listCustomerRepricingConfigsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "accounts/account-2188/customers/customer-2188"; + client.listCustomerRepricingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomerRepricingConfigTest() throws Exception { + CustomerRepricingConfig expectedResponse = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + CustomerName parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + CustomerRepricingConfig customerRepricingConfig = CustomerRepricingConfig.newBuilder().build(); + + CustomerRepricingConfig actualResponse = + client.createCustomerRepricingConfig(parent, customerRepricingConfig); + 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 createCustomerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerName parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder().build(); + client.createCustomerRepricingConfig(parent, customerRepricingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomerRepricingConfigTest2() throws Exception { + CustomerRepricingConfig expectedResponse = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "accounts/account-2188/customers/customer-2188"; + CustomerRepricingConfig customerRepricingConfig = CustomerRepricingConfig.newBuilder().build(); + + CustomerRepricingConfig actualResponse = + client.createCustomerRepricingConfig(parent, customerRepricingConfig); + 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 createCustomerRepricingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "accounts/account-2188/customers/customer-2188"; + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder().build(); + client.createCustomerRepricingConfig(parent, customerRepricingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCustomerRepricingConfigTest() throws Exception { + CustomerRepricingConfig expectedResponse = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + + CustomerRepricingConfig actualResponse = + client.updateCustomerRepricingConfig(customerRepricingConfig); + 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 updateCustomerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + client.updateCustomerRepricingConfig(customerRepricingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteCustomerRepricingConfigTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + CustomerRepricingConfigName name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]"); + + client.deleteCustomerRepricingConfig(name); + + 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 deleteCustomerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomerRepricingConfigName name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]"); + client.deleteCustomerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteCustomerRepricingConfigTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "accounts/account-6999/customers/customer-6999/customerRepricingConfigs/customerRepricingConfig-6999"; + + client.deleteCustomerRepricingConfig(name); + + 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 deleteCustomerRepricingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "accounts/account-6999/customers/customer-6999/customerRepricingConfigs/customerRepricingConfig-6999"; + client.deleteCustomerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getChannelPartnerRepricingConfigTest() throws Exception { + ChannelPartnerRepricingConfig expectedResponse = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ChannelPartnerRepricingConfigName name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]"); + + ChannelPartnerRepricingConfig actualResponse = client.getChannelPartnerRepricingConfig(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 getChannelPartnerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChannelPartnerRepricingConfigName name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]"); + client.getChannelPartnerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getChannelPartnerRepricingConfigTest2() throws Exception { + ChannelPartnerRepricingConfig expectedResponse = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "accounts/account-6447/channelPartnerLinks/channelPartnerLink-6447/channelPartnerRepricingConfigs/channelPartnerRepricingConfig-6447"; + + ChannelPartnerRepricingConfig actualResponse = client.getChannelPartnerRepricingConfig(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 getChannelPartnerRepricingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "accounts/account-6447/channelPartnerLinks/channelPartnerLink-6447/channelPartnerRepricingConfigs/channelPartnerRepricingConfig-6447"; + client.getChannelPartnerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listChannelPartnerRepricingConfigsTest() throws Exception { + ChannelPartnerRepricingConfig responsesElement = + ChannelPartnerRepricingConfig.newBuilder().build(); + ListChannelPartnerRepricingConfigsResponse expectedResponse = + ListChannelPartnerRepricingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllChannelPartnerRepricingConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ChannelPartnerLinkName parent = + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]"); + + ListChannelPartnerRepricingConfigsPagedResponse pagedListResponse = + client.listChannelPartnerRepricingConfigs(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getChannelPartnerRepricingConfigsList().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 listChannelPartnerRepricingConfigsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChannelPartnerLinkName parent = + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]"); + client.listChannelPartnerRepricingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listChannelPartnerRepricingConfigsTest2() throws Exception { + ChannelPartnerRepricingConfig responsesElement = + ChannelPartnerRepricingConfig.newBuilder().build(); + ListChannelPartnerRepricingConfigsResponse expectedResponse = + ListChannelPartnerRepricingConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllChannelPartnerRepricingConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "accounts/account-3211/channelPartnerLinks/channelPartnerLink-3211"; + + ListChannelPartnerRepricingConfigsPagedResponse pagedListResponse = + client.listChannelPartnerRepricingConfigs(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getChannelPartnerRepricingConfigsList().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 listChannelPartnerRepricingConfigsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "accounts/account-3211/channelPartnerLinks/channelPartnerLink-3211"; + client.listChannelPartnerRepricingConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createChannelPartnerRepricingConfigTest() throws Exception { + ChannelPartnerRepricingConfig expectedResponse = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ChannelPartnerLinkName parent = + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]"); + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + + ChannelPartnerRepricingConfig actualResponse = + client.createChannelPartnerRepricingConfig(parent, channelPartnerRepricingConfig); + 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 createChannelPartnerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChannelPartnerLinkName parent = + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]"); + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + client.createChannelPartnerRepricingConfig(parent, channelPartnerRepricingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createChannelPartnerRepricingConfigTest2() throws Exception { + ChannelPartnerRepricingConfig expectedResponse = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "accounts/account-3211/channelPartnerLinks/channelPartnerLink-3211"; + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + + ChannelPartnerRepricingConfig actualResponse = + client.createChannelPartnerRepricingConfig(parent, channelPartnerRepricingConfig); + 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 createChannelPartnerRepricingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "accounts/account-3211/channelPartnerLinks/channelPartnerLink-3211"; + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + client.createChannelPartnerRepricingConfig(parent, channelPartnerRepricingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateChannelPartnerRepricingConfigTest() throws Exception { + ChannelPartnerRepricingConfig expectedResponse = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + + ChannelPartnerRepricingConfig actualResponse = + client.updateChannelPartnerRepricingConfig(channelPartnerRepricingConfig); + 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 updateChannelPartnerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .setRepricingConfig(RepricingConfig.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + client.updateChannelPartnerRepricingConfig(channelPartnerRepricingConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteChannelPartnerRepricingConfigTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ChannelPartnerRepricingConfigName name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]"); + + client.deleteChannelPartnerRepricingConfig(name); + + 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 deleteChannelPartnerRepricingConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ChannelPartnerRepricingConfigName name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]"); + client.deleteChannelPartnerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteChannelPartnerRepricingConfigTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "accounts/account-6447/channelPartnerLinks/channelPartnerLink-6447/channelPartnerRepricingConfigs/channelPartnerRepricingConfig-6447"; + + client.deleteChannelPartnerRepricingConfig(name); + + 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 deleteChannelPartnerRepricingConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "accounts/account-6447/channelPartnerLinks/channelPartnerLink-6447/channelPartnerRepricingConfigs/channelPartnerRepricingConfig-6447"; + client.deleteChannelPartnerRepricingConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void lookupOfferTest() throws Exception { + Offer expectedResponse = + Offer.newBuilder() + .setName(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .setMarketingInfo(MarketingInfo.newBuilder().build()) + .setSku(Sku.newBuilder().build()) + .setPlan(Plan.newBuilder().build()) + .setConstraints(Constraints.newBuilder().build()) + .addAllPriceByResources(new ArrayList()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .addAllParameterDefinitions(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + LookupOfferRequest request = + LookupOfferRequest.newBuilder() + .setEntitlement( + EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + + Offer actualResponse = client.lookupOffer(request); + 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 lookupOfferExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LookupOfferRequest request = + LookupOfferRequest.newBuilder() + .setEntitlement( + EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + client.lookupOffer(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listProductsTest() throws Exception { + Product responsesElement = Product.newBuilder().build(); + ListProductsResponse expectedResponse = + ListProductsResponse.newBuilder() + .setNextPageToken("") + .addAllProducts(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListProductsRequest request = + ListProductsRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListProductsPagedResponse pagedListResponse = client.listProducts(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getProductsList().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 listProductsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListProductsRequest request = + ListProductsRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listProducts(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSkusTest() throws Exception { + Sku responsesElement = Sku.newBuilder().build(); + ListSkusResponse expectedResponse = + ListSkusResponse.newBuilder() + .setNextPageToken("") + .addAllSkus(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListSkusRequest request = + ListSkusRequest.newBuilder() + .setParent(ProductName.of("[PRODUCT]").toString()) + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListSkusPagedResponse pagedListResponse = client.listSkus(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSkusList().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 listSkusExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListSkusRequest request = + ListSkusRequest.newBuilder() + .setParent(ProductName.of("[PRODUCT]").toString()) + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listSkus(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOffersTest() throws Exception { + Offer responsesElement = Offer.newBuilder().build(); + ListOffersResponse expectedResponse = + ListOffersResponse.newBuilder() + .setNextPageToken("") + .addAllOffers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListOffersRequest request = + ListOffersRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListOffersPagedResponse pagedListResponse = client.listOffers(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOffersList().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 listOffersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListOffersRequest request = + ListOffersRequest.newBuilder() + .setParent("accounts/account-4811") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listOffers(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPurchasableSkusTest() throws Exception { + PurchasableSku responsesElement = PurchasableSku.newBuilder().build(); + ListPurchasableSkusResponse expectedResponse = + ListPurchasableSkusResponse.newBuilder() + .setNextPageToken("") + .addAllPurchasableSkus(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListPurchasableSkusRequest request = + ListPurchasableSkusRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListPurchasableSkusPagedResponse pagedListResponse = client.listPurchasableSkus(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPurchasableSkusList().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 listPurchasableSkusExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListPurchasableSkusRequest request = + ListPurchasableSkusRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listPurchasableSkus(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPurchasableOffersTest() throws Exception { + PurchasableOffer responsesElement = PurchasableOffer.newBuilder().build(); + ListPurchasableOffersResponse expectedResponse = + ListPurchasableOffersResponse.newBuilder() + .setNextPageToken("") + .addAllPurchasableOffers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListPurchasableOffersRequest request = + ListPurchasableOffersRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + + ListPurchasableOffersPagedResponse pagedListResponse = client.listPurchasableOffers(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPurchasableOffersList().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 listPurchasableOffersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListPurchasableOffersRequest request = + ListPurchasableOffersRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + client.listPurchasableOffers(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void registerSubscriberTest() throws Exception { + RegisterSubscriberResponse expectedResponse = + RegisterSubscriberResponse.newBuilder().setTopic("topic110546223").build(); + mockService.addResponse(expectedResponse); + + RegisterSubscriberRequest request = + RegisterSubscriberRequest.newBuilder() + .setAccount("accounts/account-7630") + .setServiceAccount("serviceAccount1079137720") + .build(); + + RegisterSubscriberResponse actualResponse = client.registerSubscriber(request); + 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 registerSubscriberExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RegisterSubscriberRequest request = + RegisterSubscriberRequest.newBuilder() + .setAccount("accounts/account-7630") + .setServiceAccount("serviceAccount1079137720") + .build(); + client.registerSubscriber(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void unregisterSubscriberTest() throws Exception { + UnregisterSubscriberResponse expectedResponse = + UnregisterSubscriberResponse.newBuilder().setTopic("topic110546223").build(); + mockService.addResponse(expectedResponse); + + UnregisterSubscriberRequest request = + UnregisterSubscriberRequest.newBuilder() + .setAccount("accounts/account-7630") + .setServiceAccount("serviceAccount1079137720") + .build(); + + UnregisterSubscriberResponse actualResponse = client.unregisterSubscriber(request); + 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 unregisterSubscriberExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UnregisterSubscriberRequest request = + UnregisterSubscriberRequest.newBuilder() + .setAccount("accounts/account-7630") + .setServiceAccount("serviceAccount1079137720") + .build(); + client.unregisterSubscriber(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSubscribersTest() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListSubscribersResponse expectedResponse = + ListSubscribersResponse.newBuilder() + .setNextPageToken("") + .addAllServiceAccounts(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListSubscribersRequest request = + ListSubscribersRequest.newBuilder() + .setAccount("accounts/account-7630") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListSubscribersPagedResponse pagedListResponse = client.listSubscribers(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getServiceAccountsList().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 listSubscribersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListSubscribersRequest request = + ListSubscribersRequest.newBuilder() + .setAccount("accounts/account-7630") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listSubscribers(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlement.java new file mode 100644 index 00000000..bc9ce406 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_activateentitlement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ActivateEntitlementRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncActivateEntitlement { + + public static void main(String[] args) throws Exception { + asyncActivateEntitlement(); + } + + public static void asyncActivateEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ActivateEntitlementRequest request = + ActivateEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.activateEntitlementCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_activateentitlement_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlementLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlementLRO.java new file mode 100644 index 00000000..ec97ce4b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/AsyncActivateEntitlementLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_activateentitlement_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.ActivateEntitlementRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; + +public class AsyncActivateEntitlementLRO { + + public static void main(String[] args) throws Exception { + asyncActivateEntitlementLRO(); + } + + public static void asyncActivateEntitlementLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ActivateEntitlementRequest request = + ActivateEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.activateEntitlementOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_activateentitlement_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/SyncActivateEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/SyncActivateEntitlement.java new file mode 100644 index 00000000..63ca9431 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/activateentitlement/SyncActivateEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_activateentitlement_sync] +import com.google.cloud.channel.v1.ActivateEntitlementRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; + +public class SyncActivateEntitlement { + + public static void main(String[] args) throws Exception { + syncActivateEntitlement(); + } + + public static void syncActivateEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ActivateEntitlementRequest request = + ActivateEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + Entitlement response = cloudChannelServiceClient.activateEntitlementAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_activateentitlement_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlement.java new file mode 100644 index 00000000..e9cd8ed7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_cancelentitlement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CancelEntitlementRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCancelEntitlement { + + public static void main(String[] args) throws Exception { + asyncCancelEntitlement(); + } + + public static void asyncCancelEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CancelEntitlementRequest request = + CancelEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.cancelEntitlementCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_cancelentitlement_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlementLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlementLRO.java new file mode 100644 index 00000000..85c6dcc9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/AsyncCancelEntitlementLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_cancelentitlement_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.CancelEntitlementRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncCancelEntitlementLRO { + + public static void main(String[] args) throws Exception { + asyncCancelEntitlementLRO(); + } + + public static void asyncCancelEntitlementLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CancelEntitlementRequest request = + CancelEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.cancelEntitlementOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_cancelentitlement_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/SyncCancelEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/SyncCancelEntitlement.java new file mode 100644 index 00000000..337e8422 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/cancelentitlement/SyncCancelEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_cancelentitlement_sync] +import com.google.cloud.channel.v1.CancelEntitlementRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncCancelEntitlement { + + public static void main(String[] args) throws Exception { + syncCancelEntitlement(); + } + + public static void syncCancelEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CancelEntitlementRequest request = + CancelEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + cloudChannelServiceClient.cancelEntitlementAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_cancelentitlement_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOffer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOffer.java new file mode 100644 index 00000000..1f995d3a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOffer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changeoffer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChangeOfferRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.OfferName; +import com.google.cloud.channel.v1.Parameter; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncChangeOffer { + + public static void main(String[] args) throws Exception { + asyncChangeOffer(); + } + + public static void asyncChangeOffer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeOfferRequest request = + ChangeOfferRequest.newBuilder() + .setName("name3373707") + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .addAllParameters(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.changeOfferCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changeoffer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOfferLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOfferLRO.java new file mode 100644 index 00000000..67618740 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/AsyncChangeOfferLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changeoffer_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.ChangeOfferRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OfferName; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.Parameter; +import java.util.ArrayList; + +public class AsyncChangeOfferLRO { + + public static void main(String[] args) throws Exception { + asyncChangeOfferLRO(); + } + + public static void asyncChangeOfferLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeOfferRequest request = + ChangeOfferRequest.newBuilder() + .setName("name3373707") + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .addAllParameters(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.changeOfferOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changeoffer_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/SyncChangeOffer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/SyncChangeOffer.java new file mode 100644 index 00000000..eaa1b89f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeoffer/SyncChangeOffer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changeoffer_sync] +import com.google.cloud.channel.v1.ChangeOfferRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OfferName; +import com.google.cloud.channel.v1.Parameter; +import java.util.ArrayList; + +public class SyncChangeOffer { + + public static void main(String[] args) throws Exception { + syncChangeOffer(); + } + + public static void syncChangeOffer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeOfferRequest request = + ChangeOfferRequest.newBuilder() + .setName("name3373707") + .setOffer(OfferName.of("[ACCOUNT]", "[OFFER]").toString()) + .addAllParameters(new ArrayList()) + .setPurchaseOrderId("purchaseOrderId2029917384") + .setRequestId("requestId693933066") + .build(); + Entitlement response = cloudChannelServiceClient.changeOfferAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changeoffer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParameters.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParameters.java new file mode 100644 index 00000000..97bc9d52 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParameters.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changeparameters_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChangeParametersRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Parameter; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncChangeParameters { + + public static void main(String[] args) throws Exception { + asyncChangeParameters(); + } + + public static void asyncChangeParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeParametersRequest request = + ChangeParametersRequest.newBuilder() + .setName("name3373707") + .addAllParameters(new ArrayList()) + .setRequestId("requestId693933066") + .setPurchaseOrderId("purchaseOrderId2029917384") + .build(); + ApiFuture future = + cloudChannelServiceClient.changeParametersCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changeparameters_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParametersLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParametersLRO.java new file mode 100644 index 00000000..5f3f0e24 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/AsyncChangeParametersLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changeparameters_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.ChangeParametersRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.Parameter; +import java.util.ArrayList; + +public class AsyncChangeParametersLRO { + + public static void main(String[] args) throws Exception { + asyncChangeParametersLRO(); + } + + public static void asyncChangeParametersLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeParametersRequest request = + ChangeParametersRequest.newBuilder() + .setName("name3373707") + .addAllParameters(new ArrayList()) + .setRequestId("requestId693933066") + .setPurchaseOrderId("purchaseOrderId2029917384") + .build(); + OperationFuture future = + cloudChannelServiceClient.changeParametersOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changeparameters_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/SyncChangeParameters.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/SyncChangeParameters.java new file mode 100644 index 00000000..cbc1eb15 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changeparameters/SyncChangeParameters.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changeparameters_sync] +import com.google.cloud.channel.v1.ChangeParametersRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.Parameter; +import java.util.ArrayList; + +public class SyncChangeParameters { + + public static void main(String[] args) throws Exception { + syncChangeParameters(); + } + + public static void syncChangeParameters() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeParametersRequest request = + ChangeParametersRequest.newBuilder() + .setName("name3373707") + .addAllParameters(new ArrayList()) + .setRequestId("requestId693933066") + .setPurchaseOrderId("purchaseOrderId2029917384") + .build(); + Entitlement response = cloudChannelServiceClient.changeParametersAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changeparameters_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettings.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettings.java new file mode 100644 index 00000000..25a6ccd2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettings.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changerenewalsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChangeRenewalSettingsRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.RenewalSettings; +import com.google.longrunning.Operation; + +public class AsyncChangeRenewalSettings { + + public static void main(String[] args) throws Exception { + asyncChangeRenewalSettings(); + } + + public static void asyncChangeRenewalSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeRenewalSettingsRequest request = + ChangeRenewalSettingsRequest.newBuilder() + .setName("name3373707") + .setRenewalSettings(RenewalSettings.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.changeRenewalSettingsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changerenewalsettings_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettingsLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettingsLRO.java new file mode 100644 index 00000000..d762ebb1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/AsyncChangeRenewalSettingsLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changerenewalsettings_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.ChangeRenewalSettingsRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.RenewalSettings; + +public class AsyncChangeRenewalSettingsLRO { + + public static void main(String[] args) throws Exception { + asyncChangeRenewalSettingsLRO(); + } + + public static void asyncChangeRenewalSettingsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeRenewalSettingsRequest request = + ChangeRenewalSettingsRequest.newBuilder() + .setName("name3373707") + .setRenewalSettings(RenewalSettings.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.changeRenewalSettingsOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changerenewalsettings_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/SyncChangeRenewalSettings.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/SyncChangeRenewalSettings.java new file mode 100644 index 00000000..ef966429 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/changerenewalsettings/SyncChangeRenewalSettings.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_changerenewalsettings_sync] +import com.google.cloud.channel.v1.ChangeRenewalSettingsRequest; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.RenewalSettings; + +public class SyncChangeRenewalSettings { + + public static void main(String[] args) throws Exception { + syncChangeRenewalSettings(); + } + + public static void syncChangeRenewalSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChangeRenewalSettingsRequest request = + ChangeRenewalSettingsRequest.newBuilder() + .setName("name3373707") + .setRenewalSettings(RenewalSettings.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Entitlement response = cloudChannelServiceClient.changeRenewalSettingsAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_changerenewalsettings_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/AsyncCheckCloudIdentityAccountsExist.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/AsyncCheckCloudIdentityAccountsExist.java new file mode 100644 index 00000000..be5b3c6d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/AsyncCheckCloudIdentityAccountsExist.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_checkcloudidentityaccountsexist_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CheckCloudIdentityAccountsExistRequest; +import com.google.cloud.channel.v1.CheckCloudIdentityAccountsExistResponse; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class AsyncCheckCloudIdentityAccountsExist { + + public static void main(String[] args) throws Exception { + asyncCheckCloudIdentityAccountsExist(); + } + + public static void asyncCheckCloudIdentityAccountsExist() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CheckCloudIdentityAccountsExistRequest request = + CheckCloudIdentityAccountsExistRequest.newBuilder() + .setParent("parent-995424086") + .setDomain("domain-1326197564") + .build(); + ApiFuture future = + cloudChannelServiceClient.checkCloudIdentityAccountsExistCallable().futureCall(request); + // Do something. + CheckCloudIdentityAccountsExistResponse response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_checkcloudidentityaccountsexist_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/SyncCheckCloudIdentityAccountsExist.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/SyncCheckCloudIdentityAccountsExist.java new file mode 100644 index 00000000..ad45e2bf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/checkcloudidentityaccountsexist/SyncCheckCloudIdentityAccountsExist.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_checkcloudidentityaccountsexist_sync] +import com.google.cloud.channel.v1.CheckCloudIdentityAccountsExistRequest; +import com.google.cloud.channel.v1.CheckCloudIdentityAccountsExistResponse; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncCheckCloudIdentityAccountsExist { + + public static void main(String[] args) throws Exception { + syncCheckCloudIdentityAccountsExist(); + } + + public static void syncCheckCloudIdentityAccountsExist() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CheckCloudIdentityAccountsExistRequest request = + CheckCloudIdentityAccountsExistRequest.newBuilder() + .setParent("parent-995424086") + .setDomain("domain-1326197564") + .build(); + CheckCloudIdentityAccountsExistResponse response = + cloudChannelServiceClient.checkCloudIdentityAccountsExist(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_checkcloudidentityaccountsexist_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..fcdf8010 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudChannelServiceSettings; +import com.google.cloud.channel.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. + CloudChannelServiceSettings cloudChannelServiceSettings = + CloudChannelServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CloudChannelServiceClient cloudChannelServiceClient = + CloudChannelServiceClient.create(cloudChannelServiceSettings); + } +} +// [END channel_v1_generated_cloudchannelserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..fb7c5289 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetCredentialsProvider1.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudChannelServiceSettings; + +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. + CloudChannelServiceSettings cloudChannelServiceSettings = + CloudChannelServiceSettings.newBuilder() + .setTransportChannelProvider( + CloudChannelServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CloudChannelServiceClient cloudChannelServiceClient = + CloudChannelServiceClient.create(cloudChannelServiceSettings); + } +} +// [END channel_v1_generated_cloudchannelserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..099f28c1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/create/SyncCreateSetEndpoint.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_create_setendpoint_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudChannelServiceSettings; +import com.google.cloud.channel.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. + CloudChannelServiceSettings cloudChannelServiceSettings = + CloudChannelServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + CloudChannelServiceClient cloudChannelServiceClient = + CloudChannelServiceClient.create(cloudChannelServiceSettings); + } +} +// [END channel_v1_generated_cloudchannelserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/AsyncCreateChannelPartnerLink.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/AsyncCreateChannelPartnerLink.java new file mode 100644 index 00000000..2c9bbba2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/AsyncCreateChannelPartnerLink.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createchannelpartnerlink_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateChannelPartnerLinkRequest; + +public class AsyncCreateChannelPartnerLink { + + public static void main(String[] args) throws Exception { + asyncCreateChannelPartnerLink(); + } + + public static void asyncCreateChannelPartnerLink() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateChannelPartnerLinkRequest request = + CreateChannelPartnerLinkRequest.newBuilder() + .setParent("parent-995424086") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient.createChannelPartnerLinkCallable().futureCall(request); + // Do something. + ChannelPartnerLink response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createchannelpartnerlink_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/SyncCreateChannelPartnerLink.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/SyncCreateChannelPartnerLink.java new file mode 100644 index 00000000..74ebdc2c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerlink/SyncCreateChannelPartnerLink.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createchannelpartnerlink_sync] +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateChannelPartnerLinkRequest; + +public class SyncCreateChannelPartnerLink { + + public static void main(String[] args) throws Exception { + syncCreateChannelPartnerLink(); + } + + public static void syncCreateChannelPartnerLink() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateChannelPartnerLinkRequest request = + CreateChannelPartnerLinkRequest.newBuilder() + .setParent("parent-995424086") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .build(); + ChannelPartnerLink response = cloudChannelServiceClient.createChannelPartnerLink(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createchannelpartnerlink_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/AsyncCreateChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/AsyncCreateChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..328f3c22 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/AsyncCreateChannelPartnerRepricingConfig.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateChannelPartnerRepricingConfigRequest; + +public class AsyncCreateChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncCreateChannelPartnerRepricingConfig(); + } + + public static void asyncCreateChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateChannelPartnerRepricingConfigRequest request = + CreateChannelPartnerRepricingConfigRequest.newBuilder() + .setParent( + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setChannelPartnerRepricingConfig(ChannelPartnerRepricingConfig.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient + .createChannelPartnerRepricingConfigCallable() + .futureCall(request); + // Do something. + ChannelPartnerRepricingConfig response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..cc24dead --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateChannelPartnerRepricingConfigRequest; + +public class SyncCreateChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncCreateChannelPartnerRepricingConfig(); + } + + public static void syncCreateChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateChannelPartnerRepricingConfigRequest request = + CreateChannelPartnerRepricingConfigRequest.newBuilder() + .setParent( + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setChannelPartnerRepricingConfig(ChannelPartnerRepricingConfig.newBuilder().build()) + .build(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.createChannelPartnerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig.java new file mode 100644 index 00000000..e0e3e941 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_channelpartnerlinknamechannelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public +class SyncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig { + + public static void main(String[] args) throws Exception { + syncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig(); + } + + public static void + syncCreateChannelPartnerRepricingConfigChannelpartnerlinknameChannelpartnerrepricingconfig() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChannelPartnerLinkName parent = + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]"); + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.createChannelPartnerRepricingConfig( + parent, channelPartnerRepricingConfig); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_channelpartnerlinknamechannelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig.java new file mode 100644 index 00000000..4cdba327 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createchannelpartnerrepricingconfig/SyncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_stringchannelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig { + + public static void main(String[] args) throws Exception { + syncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig(); + } + + public static void syncCreateChannelPartnerRepricingConfigStringChannelpartnerrepricingconfig() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String parent = ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString(); + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.createChannelPartnerRepricingConfig( + parent, channelPartnerRepricingConfig); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_createchannelpartnerrepricingconfig_stringchannelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/AsyncCreateCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/AsyncCreateCustomer.java new file mode 100644 index 00000000..dcd91048 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/AsyncCreateCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createcustomer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateCustomerRequest; +import com.google.cloud.channel.v1.Customer; + +public class AsyncCreateCustomer { + + public static void main(String[] args) throws Exception { + asyncCreateCustomer(); + } + + public static void asyncCreateCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateCustomerRequest request = + CreateCustomerRequest.newBuilder() + .setParent("parent-995424086") + .setCustomer(Customer.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient.createCustomerCallable().futureCall(request); + // Do something. + Customer response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createcustomer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/SyncCreateCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/SyncCreateCustomer.java new file mode 100644 index 00000000..3463e2ac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomer/SyncCreateCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createcustomer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateCustomerRequest; +import com.google.cloud.channel.v1.Customer; + +public class SyncCreateCustomer { + + public static void main(String[] args) throws Exception { + syncCreateCustomer(); + } + + public static void syncCreateCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateCustomerRequest request = + CreateCustomerRequest.newBuilder() + .setParent("parent-995424086") + .setCustomer(Customer.newBuilder().build()) + .build(); + Customer response = cloudChannelServiceClient.createCustomer(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createcustomer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/AsyncCreateCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/AsyncCreateCustomerRepricingConfig.java new file mode 100644 index 00000000..0d8a616a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/AsyncCreateCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateCustomerRepricingConfigRequest; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class AsyncCreateCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncCreateCustomerRepricingConfig(); + } + + public static void asyncCreateCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateCustomerRepricingConfigRequest request = + CreateCustomerRepricingConfigRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCustomerRepricingConfig(CustomerRepricingConfig.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient.createCustomerRepricingConfigCallable().futureCall(request); + // Do something. + CustomerRepricingConfig response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfig.java new file mode 100644 index 00000000..c162009a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateCustomerRepricingConfigRequest; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class SyncCreateCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncCreateCustomerRepricingConfig(); + } + + public static void syncCreateCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateCustomerRepricingConfigRequest request = + CreateCustomerRepricingConfigRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCustomerRepricingConfig(CustomerRepricingConfig.newBuilder().build()) + .build(); + CustomerRepricingConfig response = + cloudChannelServiceClient.createCustomerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig.java new file mode 100644 index 00000000..fd48c920 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_customernamecustomerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class SyncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig { + + public static void main(String[] args) throws Exception { + syncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig(); + } + + public static void syncCreateCustomerRepricingConfigCustomernameCustomerrepricingconfig() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerName parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder().build(); + CustomerRepricingConfig response = + cloudChannelServiceClient.createCustomerRepricingConfig(parent, customerRepricingConfig); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_customernamecustomerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigStringCustomerrepricingconfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigStringCustomerrepricingconfig.java new file mode 100644 index 00000000..20f83e4e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createcustomerrepricingconfig/SyncCreateCustomerRepricingConfigStringCustomerrepricingconfig.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_stringcustomerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class SyncCreateCustomerRepricingConfigStringCustomerrepricingconfig { + + public static void main(String[] args) throws Exception { + syncCreateCustomerRepricingConfigStringCustomerrepricingconfig(); + } + + public static void syncCreateCustomerRepricingConfigStringCustomerrepricingconfig() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString(); + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder().build(); + CustomerRepricingConfig response = + cloudChannelServiceClient.createCustomerRepricingConfig(parent, customerRepricingConfig); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_createcustomerrepricingconfig_stringcustomerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlement.java new file mode 100644 index 00000000..fcf358dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createentitlement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateEntitlementRequest; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.Entitlement; +import com.google.longrunning.Operation; + +public class AsyncCreateEntitlement { + + public static void main(String[] args) throws Exception { + asyncCreateEntitlement(); + } + + public static void asyncCreateEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateEntitlementRequest request = + CreateEntitlementRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setEntitlement(Entitlement.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.createEntitlementCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createentitlement_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlementLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlementLRO.java new file mode 100644 index 00000000..0e1e03cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/AsyncCreateEntitlementLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createentitlement_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateEntitlementRequest; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; + +public class AsyncCreateEntitlementLRO { + + public static void main(String[] args) throws Exception { + asyncCreateEntitlementLRO(); + } + + public static void asyncCreateEntitlementLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateEntitlementRequest request = + CreateEntitlementRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setEntitlement(Entitlement.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.createEntitlementOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createentitlement_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/SyncCreateEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/SyncCreateEntitlement.java new file mode 100644 index 00000000..4b19579d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/createentitlement/SyncCreateEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_createentitlement_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CreateEntitlementRequest; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.Entitlement; + +public class SyncCreateEntitlement { + + public static void main(String[] args) throws Exception { + syncCreateEntitlement(); + } + + public static void syncCreateEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CreateEntitlementRequest request = + CreateEntitlementRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setEntitlement(Entitlement.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Entitlement response = cloudChannelServiceClient.createEntitlementAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_createentitlement_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/AsyncDeleteChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/AsyncDeleteChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..8b76420e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/AsyncDeleteChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.DeleteChannelPartnerRepricingConfigRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncDeleteChannelPartnerRepricingConfig(); + } + + public static void asyncDeleteChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + DeleteChannelPartnerRepricingConfigRequest request = + DeleteChannelPartnerRepricingConfigRequest.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient + .deleteChannelPartnerRepricingConfigCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..9accb6ca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.DeleteChannelPartnerRepricingConfigRequest; + +public class SyncDeleteChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncDeleteChannelPartnerRepricingConfig(); + } + + public static void syncDeleteChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + DeleteChannelPartnerRepricingConfigRequest request = + DeleteChannelPartnerRepricingConfigRequest.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .build(); + cloudChannelServiceClient.deleteChannelPartnerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.java new file mode 100644 index 00000000..74aaeab9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_channelpartnerrepricingconfigname_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname { + + public static void main(String[] args) throws Exception { + syncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname(); + } + + public static void syncDeleteChannelPartnerRepricingConfigChannelpartnerrepricingconfigname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChannelPartnerRepricingConfigName name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]"); + cloudChannelServiceClient.deleteChannelPartnerRepricingConfig(name); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_channelpartnerrepricingconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigString.java new file mode 100644 index 00000000..eeec59af --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletechannelpartnerrepricingconfig/SyncDeleteChannelPartnerRepricingConfigString.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_string_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncDeleteChannelPartnerRepricingConfigString { + + public static void main(String[] args) throws Exception { + syncDeleteChannelPartnerRepricingConfigString(); + } + + public static void syncDeleteChannelPartnerRepricingConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString(); + cloudChannelServiceClient.deleteChannelPartnerRepricingConfig(name); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_deletechannelpartnerrepricingconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/AsyncDeleteCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/AsyncDeleteCustomer.java new file mode 100644 index 00000000..131d300b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/AsyncDeleteCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.DeleteCustomerRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteCustomer { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomer(); + } + + public static void asyncDeleteCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + DeleteCustomerRequest request = + DeleteCustomerRequest.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.deleteCustomerCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomer.java new file mode 100644 index 00000000..29983dc0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.DeleteCustomerRequest; + +public class SyncDeleteCustomer { + + public static void main(String[] args) throws Exception { + syncDeleteCustomer(); + } + + public static void syncDeleteCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + DeleteCustomerRequest request = + DeleteCustomerRequest.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + cloudChannelServiceClient.deleteCustomer(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerCustomername.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerCustomername.java new file mode 100644 index 00000000..f3cbf507 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerCustomername.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomer_customername_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; + +public class SyncDeleteCustomerCustomername { + + public static void main(String[] args) throws Exception { + syncDeleteCustomerCustomername(); + } + + public static void syncDeleteCustomerCustomername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerName name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + cloudChannelServiceClient.deleteCustomer(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomer_customername_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerString.java new file mode 100644 index 00000000..56e2e656 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomer/SyncDeleteCustomerString.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomer_string_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; + +public class SyncDeleteCustomerString { + + public static void main(String[] args) throws Exception { + syncDeleteCustomerString(); + } + + public static void syncDeleteCustomerString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString(); + cloudChannelServiceClient.deleteCustomer(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomer_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/AsyncDeleteCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/AsyncDeleteCustomerRepricingConfig.java new file mode 100644 index 00000000..c302f2a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/AsyncDeleteCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; +import com.google.cloud.channel.v1.DeleteCustomerRepricingConfigRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomerRepricingConfig(); + } + + public static void asyncDeleteCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + DeleteCustomerRepricingConfigRequest request = + DeleteCustomerRepricingConfigRequest.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.deleteCustomerRepricingConfigCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfig.java new file mode 100644 index 00000000..d831f5b2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; +import com.google.cloud.channel.v1.DeleteCustomerRepricingConfigRequest; + +public class SyncDeleteCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncDeleteCustomerRepricingConfig(); + } + + public static void syncDeleteCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + DeleteCustomerRepricingConfigRequest request = + DeleteCustomerRepricingConfigRequest.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .build(); + cloudChannelServiceClient.deleteCustomerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigCustomerrepricingconfigname.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigCustomerrepricingconfigname.java new file mode 100644 index 00000000..d73d5a8b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigCustomerrepricingconfigname.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_customerrepricingconfigname_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; + +public class SyncDeleteCustomerRepricingConfigCustomerrepricingconfigname { + + public static void main(String[] args) throws Exception { + syncDeleteCustomerRepricingConfigCustomerrepricingconfigname(); + } + + public static void syncDeleteCustomerRepricingConfigCustomerrepricingconfigname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerRepricingConfigName name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]"); + cloudChannelServiceClient.deleteCustomerRepricingConfig(name); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_customerrepricingconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigString.java new file mode 100644 index 00000000..81c441f0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/deletecustomerrepricingconfig/SyncDeleteCustomerRepricingConfigString.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_string_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; + +public class SyncDeleteCustomerRepricingConfigString { + + public static void main(String[] args) throws Exception { + syncDeleteCustomerRepricingConfigString(); + } + + public static void syncDeleteCustomerRepricingConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString(); + cloudChannelServiceClient.deleteCustomerRepricingConfig(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_deletecustomerrepricingconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/AsyncGetChannelPartnerLink.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/AsyncGetChannelPartnerLink.java new file mode 100644 index 00000000..d53eb099 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/AsyncGetChannelPartnerLink.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getchannelpartnerlink_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.ChannelPartnerLinkView; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.GetChannelPartnerLinkRequest; + +public class AsyncGetChannelPartnerLink { + + public static void main(String[] args) throws Exception { + asyncGetChannelPartnerLink(); + } + + public static void asyncGetChannelPartnerLink() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetChannelPartnerLinkRequest request = + GetChannelPartnerLinkRequest.newBuilder() + .setName("name3373707") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + ApiFuture future = + cloudChannelServiceClient.getChannelPartnerLinkCallable().futureCall(request); + // Do something. + ChannelPartnerLink response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getchannelpartnerlink_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/SyncGetChannelPartnerLink.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/SyncGetChannelPartnerLink.java new file mode 100644 index 00000000..d311a735 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerlink/SyncGetChannelPartnerLink.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getchannelpartnerlink_sync] +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.ChannelPartnerLinkView; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.GetChannelPartnerLinkRequest; + +public class SyncGetChannelPartnerLink { + + public static void main(String[] args) throws Exception { + syncGetChannelPartnerLink(); + } + + public static void syncGetChannelPartnerLink() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetChannelPartnerLinkRequest request = + GetChannelPartnerLinkRequest.newBuilder() + .setName("name3373707") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + ChannelPartnerLink response = cloudChannelServiceClient.getChannelPartnerLink(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getchannelpartnerlink_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/AsyncGetChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/AsyncGetChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..98832a01 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/AsyncGetChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.GetChannelPartnerRepricingConfigRequest; + +public class AsyncGetChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncGetChannelPartnerRepricingConfig(); + } + + public static void asyncGetChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetChannelPartnerRepricingConfigRequest request = + GetChannelPartnerRepricingConfigRequest.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.getChannelPartnerRepricingConfigCallable().futureCall(request); + // Do something. + ChannelPartnerRepricingConfig response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..e7801a9b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.GetChannelPartnerRepricingConfigRequest; + +public class SyncGetChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncGetChannelPartnerRepricingConfig(); + } + + public static void syncGetChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetChannelPartnerRepricingConfigRequest request = + GetChannelPartnerRepricingConfigRequest.newBuilder() + .setName( + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString()) + .build(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.getChannelPartnerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.java new file mode 100644 index 00000000..f8c3d96c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_channelpartnerrepricingconfigname_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname { + + public static void main(String[] args) throws Exception { + syncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname(); + } + + public static void syncGetChannelPartnerRepricingConfigChannelpartnerrepricingconfigname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChannelPartnerRepricingConfigName name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]"); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.getChannelPartnerRepricingConfig(name); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_channelpartnerrepricingconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigString.java new file mode 100644 index 00000000..f4abe7dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getchannelpartnerrepricingconfig/SyncGetChannelPartnerRepricingConfigString.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_string_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfigName; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncGetChannelPartnerRepricingConfigString { + + public static void main(String[] args) throws Exception { + syncGetChannelPartnerRepricingConfigString(); + } + + public static void syncGetChannelPartnerRepricingConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String name = + ChannelPartnerRepricingConfigName.of( + "[ACCOUNT]", "[CHANNEL_PARTNER]", "[CHANNEL_PARTNER_REPRICING_CONFIG]") + .toString(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.getChannelPartnerRepricingConfig(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getchannelpartnerrepricingconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/AsyncGetCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/AsyncGetCustomer.java new file mode 100644 index 00000000..7183a019 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/AsyncGetCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.GetCustomerRequest; + +public class AsyncGetCustomer { + + public static void main(String[] args) throws Exception { + asyncGetCustomer(); + } + + public static void asyncGetCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetCustomerRequest request = + GetCustomerRequest.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.getCustomerCallable().futureCall(request); + // Do something. + Customer response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomer.java new file mode 100644 index 00000000..6449dc8a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.GetCustomerRequest; + +public class SyncGetCustomer { + + public static void main(String[] args) throws Exception { + syncGetCustomer(); + } + + public static void syncGetCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetCustomerRequest request = + GetCustomerRequest.newBuilder() + .setName(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + Customer response = cloudChannelServiceClient.getCustomer(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerCustomername.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerCustomername.java new file mode 100644 index 00000000..08f8d288 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerCustomername.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomer_customername_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; + +public class SyncGetCustomerCustomername { + + public static void main(String[] args) throws Exception { + syncGetCustomerCustomername(); + } + + public static void syncGetCustomerCustomername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerName name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + Customer response = cloudChannelServiceClient.getCustomer(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomer_customername_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerString.java new file mode 100644 index 00000000..abc5bb7c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomer/SyncGetCustomerString.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomer_string_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; + +public class SyncGetCustomerString { + + public static void main(String[] args) throws Exception { + syncGetCustomerString(); + } + + public static void syncGetCustomerString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String name = CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString(); + Customer response = cloudChannelServiceClient.getCustomer(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomer_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/AsyncGetCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/AsyncGetCustomerRepricingConfig.java new file mode 100644 index 00000000..095e2c06 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/AsyncGetCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; +import com.google.cloud.channel.v1.GetCustomerRepricingConfigRequest; + +public class AsyncGetCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncGetCustomerRepricingConfig(); + } + + public static void asyncGetCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetCustomerRepricingConfigRequest request = + GetCustomerRepricingConfigRequest.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.getCustomerRepricingConfigCallable().futureCall(request); + // Do something. + CustomerRepricingConfig response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfig.java new file mode 100644 index 00000000..07791c01 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; +import com.google.cloud.channel.v1.GetCustomerRepricingConfigRequest; + +public class SyncGetCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncGetCustomerRepricingConfig(); + } + + public static void syncGetCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetCustomerRepricingConfigRequest request = + GetCustomerRepricingConfigRequest.newBuilder() + .setName( + CustomerRepricingConfigName.of( + "[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString()) + .build(); + CustomerRepricingConfig response = + cloudChannelServiceClient.getCustomerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigCustomerrepricingconfigname.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigCustomerrepricingconfigname.java new file mode 100644 index 00000000..df6db0fb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigCustomerrepricingconfigname.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_customerrepricingconfigname_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; + +public class SyncGetCustomerRepricingConfigCustomerrepricingconfigname { + + public static void main(String[] args) throws Exception { + syncGetCustomerRepricingConfigCustomerrepricingconfigname(); + } + + public static void syncGetCustomerRepricingConfigCustomerrepricingconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerRepricingConfigName name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]"); + CustomerRepricingConfig response = cloudChannelServiceClient.getCustomerRepricingConfig(name); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_customerrepricingconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigString.java new file mode 100644 index 00000000..a470000e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getcustomerrepricingconfig/SyncGetCustomerRepricingConfigString.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_string_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.CustomerRepricingConfigName; + +public class SyncGetCustomerRepricingConfigString { + + public static void main(String[] args) throws Exception { + syncGetCustomerRepricingConfigString(); + } + + public static void syncGetCustomerRepricingConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String name = + CustomerRepricingConfigName.of("[ACCOUNT]", "[CUSTOMER]", "[CUSTOMER_REPRICING_CONFIG]") + .toString(); + CustomerRepricingConfig response = cloudChannelServiceClient.getCustomerRepricingConfig(name); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getcustomerrepricingconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/AsyncGetEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/AsyncGetEntitlement.java new file mode 100644 index 00000000..e6bb4ef0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/AsyncGetEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getentitlement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.EntitlementName; +import com.google.cloud.channel.v1.GetEntitlementRequest; + +public class AsyncGetEntitlement { + + public static void main(String[] args) throws Exception { + asyncGetEntitlement(); + } + + public static void asyncGetEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetEntitlementRequest request = + GetEntitlementRequest.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.getEntitlementCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getentitlement_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/SyncGetEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/SyncGetEntitlement.java new file mode 100644 index 00000000..70b000cb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/getentitlement/SyncGetEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_getentitlement_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.EntitlementName; +import com.google.cloud.channel.v1.GetEntitlementRequest; + +public class SyncGetEntitlement { + + public static void main(String[] args) throws Exception { + syncGetEntitlement(); + } + + public static void syncGetEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + GetEntitlementRequest request = + GetEntitlementRequest.newBuilder() + .setName(EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + Entitlement response = cloudChannelServiceClient.getEntitlement(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_getentitlement_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/AsyncImportCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/AsyncImportCustomer.java new file mode 100644 index 00000000..ac49ebf4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/AsyncImportCustomer.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_importcustomer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ImportCustomerRequest; + +public class AsyncImportCustomer { + + public static void main(String[] args) throws Exception { + asyncImportCustomer(); + } + + public static void asyncImportCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ImportCustomerRequest request = + ImportCustomerRequest.newBuilder() + .setParent("parent-995424086") + .setAuthToken("authToken1450587441") + .setOverwriteIfExists(true) + .setChannelPartnerId("channelPartnerId-170366400") + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + ApiFuture future = + cloudChannelServiceClient.importCustomerCallable().futureCall(request); + // Do something. + Customer response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_importcustomer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/SyncImportCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/SyncImportCustomer.java new file mode 100644 index 00000000..ac83572b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/importcustomer/SyncImportCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_importcustomer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ImportCustomerRequest; + +public class SyncImportCustomer { + + public static void main(String[] args) throws Exception { + syncImportCustomer(); + } + + public static void syncImportCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ImportCustomerRequest request = + ImportCustomerRequest.newBuilder() + .setParent("parent-995424086") + .setAuthToken("authToken1450587441") + .setOverwriteIfExists(true) + .setChannelPartnerId("channelPartnerId-170366400") + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .build(); + Customer response = cloudChannelServiceClient.importCustomer(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_importcustomer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinks.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinks.java new file mode 100644 index 00000000..4434f70a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinks.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listchannelpartnerlinks_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.ChannelPartnerLinkView; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest; + +public class AsyncListChannelPartnerLinks { + + public static void main(String[] args) throws Exception { + asyncListChannelPartnerLinks(); + } + + public static void asyncListChannelPartnerLinks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListChannelPartnerLinksRequest request = + ListChannelPartnerLinksRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + ApiFuture future = + cloudChannelServiceClient.listChannelPartnerLinksPagedCallable().futureCall(request); + // Do something. + for (ChannelPartnerLink element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listchannelpartnerlinks_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinksPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinksPaged.java new file mode 100644 index 00000000..7ebe77e6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/AsyncListChannelPartnerLinksPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listchannelpartnerlinks_paged_async] +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.ChannelPartnerLinkView; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest; +import com.google.cloud.channel.v1.ListChannelPartnerLinksResponse; +import com.google.common.base.Strings; + +public class AsyncListChannelPartnerLinksPaged { + + public static void main(String[] args) throws Exception { + asyncListChannelPartnerLinksPaged(); + } + + public static void asyncListChannelPartnerLinksPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListChannelPartnerLinksRequest request = + ListChannelPartnerLinksRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + while (true) { + ListChannelPartnerLinksResponse response = + cloudChannelServiceClient.listChannelPartnerLinksCallable().call(request); + for (ChannelPartnerLink element : response.getChannelPartnerLinksList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listchannelpartnerlinks_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/SyncListChannelPartnerLinks.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/SyncListChannelPartnerLinks.java new file mode 100644 index 00000000..aab6e47a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerlinks/SyncListChannelPartnerLinks.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listchannelpartnerlinks_sync] +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.ChannelPartnerLinkView; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest; + +public class SyncListChannelPartnerLinks { + + public static void main(String[] args) throws Exception { + syncListChannelPartnerLinks(); + } + + public static void syncListChannelPartnerLinks() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListChannelPartnerLinksRequest request = + ListChannelPartnerLinksRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setView(ChannelPartnerLinkView.forNumber(0)) + .build(); + for (ChannelPartnerLink element : + cloudChannelServiceClient.listChannelPartnerLinks(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listchannelpartnerlinks_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigs.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigs.java new file mode 100644 index 00000000..8ad0b3c8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigs.java @@ -0,0 +1,55 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest; + +public class AsyncListChannelPartnerRepricingConfigs { + + public static void main(String[] args) throws Exception { + asyncListChannelPartnerRepricingConfigs(); + } + + public static void asyncListChannelPartnerRepricingConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListChannelPartnerRepricingConfigsRequest request = + ListChannelPartnerRepricingConfigsRequest.newBuilder() + .setParent( + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + cloudChannelServiceClient + .listChannelPartnerRepricingConfigsPagedCallable() + .futureCall(request); + // Do something. + for (ChannelPartnerRepricingConfig element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigsPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigsPaged.java new file mode 100644 index 00000000..08236e24 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/AsyncListChannelPartnerRepricingConfigsPaged.java @@ -0,0 +1,64 @@ +/* + * 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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_paged_async] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest; +import com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse; +import com.google.common.base.Strings; + +public class AsyncListChannelPartnerRepricingConfigsPaged { + + public static void main(String[] args) throws Exception { + asyncListChannelPartnerRepricingConfigsPaged(); + } + + public static void asyncListChannelPartnerRepricingConfigsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListChannelPartnerRepricingConfigsRequest request = + ListChannelPartnerRepricingConfigsRequest.newBuilder() + .setParent( + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListChannelPartnerRepricingConfigsResponse response = + cloudChannelServiceClient.listChannelPartnerRepricingConfigsCallable().call(request); + for (ChannelPartnerRepricingConfig element : + response.getChannelPartnerRepricingConfigsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigs.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigs.java new file mode 100644 index 00000000..c2000f80 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigs.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_sync] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest; + +public class SyncListChannelPartnerRepricingConfigs { + + public static void main(String[] args) throws Exception { + syncListChannelPartnerRepricingConfigs(); + } + + public static void syncListChannelPartnerRepricingConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListChannelPartnerRepricingConfigsRequest request = + ListChannelPartnerRepricingConfigsRequest.newBuilder() + .setParent( + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (ChannelPartnerRepricingConfig element : + cloudChannelServiceClient.listChannelPartnerRepricingConfigs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsChannelpartnerlinkname.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsChannelpartnerlinkname.java new file mode 100644 index 00000000..e3843e57 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsChannelpartnerlinkname.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_channelpartnerlinkname_sync] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncListChannelPartnerRepricingConfigsChannelpartnerlinkname { + + public static void main(String[] args) throws Exception { + syncListChannelPartnerRepricingConfigsChannelpartnerlinkname(); + } + + public static void syncListChannelPartnerRepricingConfigsChannelpartnerlinkname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChannelPartnerLinkName parent = + ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]"); + for (ChannelPartnerRepricingConfig element : + cloudChannelServiceClient.listChannelPartnerRepricingConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_channelpartnerlinkname_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsString.java new file mode 100644 index 00000000..286c0c22 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listchannelpartnerrepricingconfigs/SyncListChannelPartnerRepricingConfigsString.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_string_sync] +import com.google.cloud.channel.v1.ChannelPartnerLinkName; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncListChannelPartnerRepricingConfigsString { + + public static void main(String[] args) throws Exception { + syncListChannelPartnerRepricingConfigsString(); + } + + public static void syncListChannelPartnerRepricingConfigsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String parent = ChannelPartnerLinkName.of("[ACCOUNT]", "[CHANNEL_PARTNER_LINK]").toString(); + for (ChannelPartnerRepricingConfig element : + cloudChannelServiceClient.listChannelPartnerRepricingConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_listchannelpartnerrepricingconfigs_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigs.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigs.java new file mode 100644 index 00000000..30cc933a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigs.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.ListCustomerRepricingConfigsRequest; + +public class AsyncListCustomerRepricingConfigs { + + public static void main(String[] args) throws Exception { + asyncListCustomerRepricingConfigs(); + } + + public static void asyncListCustomerRepricingConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListCustomerRepricingConfigsRequest request = + ListCustomerRepricingConfigsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + cloudChannelServiceClient.listCustomerRepricingConfigsPagedCallable().futureCall(request); + // Do something. + for (CustomerRepricingConfig element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigsPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigsPaged.java new file mode 100644 index 00000000..b53eb7af --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/AsyncListCustomerRepricingConfigsPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.ListCustomerRepricingConfigsRequest; +import com.google.cloud.channel.v1.ListCustomerRepricingConfigsResponse; +import com.google.common.base.Strings; + +public class AsyncListCustomerRepricingConfigsPaged { + + public static void main(String[] args) throws Exception { + asyncListCustomerRepricingConfigsPaged(); + } + + public static void asyncListCustomerRepricingConfigsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListCustomerRepricingConfigsRequest request = + ListCustomerRepricingConfigsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListCustomerRepricingConfigsResponse response = + cloudChannelServiceClient.listCustomerRepricingConfigsCallable().call(request); + for (CustomerRepricingConfig element : response.getCustomerRepricingConfigsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigs.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigs.java new file mode 100644 index 00000000..fff456de --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigs.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.ListCustomerRepricingConfigsRequest; + +public class SyncListCustomerRepricingConfigs { + + public static void main(String[] args) throws Exception { + syncListCustomerRepricingConfigs(); + } + + public static void syncListCustomerRepricingConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListCustomerRepricingConfigsRequest request = + ListCustomerRepricingConfigsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (CustomerRepricingConfig element : + cloudChannelServiceClient.listCustomerRepricingConfigs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsCustomername.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsCustomername.java new file mode 100644 index 00000000..b7895fc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsCustomername.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_customername_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class SyncListCustomerRepricingConfigsCustomername { + + public static void main(String[] args) throws Exception { + syncListCustomerRepricingConfigsCustomername(); + } + + public static void syncListCustomerRepricingConfigsCustomername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerName parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]"); + for (CustomerRepricingConfig element : + cloudChannelServiceClient.listCustomerRepricingConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_customername_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsString.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsString.java new file mode 100644 index 00000000..45b8377a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomerrepricingconfigs/SyncListCustomerRepricingConfigsString.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_string_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class SyncListCustomerRepricingConfigsString { + + public static void main(String[] args) throws Exception { + syncListCustomerRepricingConfigsString(); + } + + public static void syncListCustomerRepricingConfigsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + String parent = CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString(); + for (CustomerRepricingConfig element : + cloudChannelServiceClient.listCustomerRepricingConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomerrepricingconfigs_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomers.java new file mode 100644 index 00000000..e625f55a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomers.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.ListCustomersRequest; + +public class AsyncListCustomers { + + public static void main(String[] args) throws Exception { + asyncListCustomers(); + } + + public static void asyncListCustomers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListCustomersRequest request = + ListCustomersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + cloudChannelServiceClient.listCustomersPagedCallable().futureCall(request); + // Do something. + for (Customer element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomers_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomersPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomersPaged.java new file mode 100644 index 00000000..b55fffb4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/AsyncListCustomersPaged.java @@ -0,0 +1,59 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomers_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.ListCustomersRequest; +import com.google.cloud.channel.v1.ListCustomersResponse; +import com.google.common.base.Strings; + +public class AsyncListCustomersPaged { + + public static void main(String[] args) throws Exception { + asyncListCustomersPaged(); + } + + public static void asyncListCustomersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListCustomersRequest request = + ListCustomersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListCustomersResponse response = + cloudChannelServiceClient.listCustomersCallable().call(request); + for (Customer element : response.getCustomersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomers_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/SyncListCustomers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/SyncListCustomers.java new file mode 100644 index 00000000..0d97749d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listcustomers/SyncListCustomers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listcustomers_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.ListCustomersRequest; + +public class SyncListCustomers { + + public static void main(String[] args) throws Exception { + syncListCustomers(); + } + + public static void syncListCustomers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListCustomersRequest request = + ListCustomersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Customer element : cloudChannelServiceClient.listCustomers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listcustomers_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlements.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlements.java new file mode 100644 index 00000000..42232a50 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlements.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listentitlements_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.ListEntitlementsRequest; + +public class AsyncListEntitlements { + + public static void main(String[] args) throws Exception { + asyncListEntitlements(); + } + + public static void asyncListEntitlements() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListEntitlementsRequest request = + ListEntitlementsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + cloudChannelServiceClient.listEntitlementsPagedCallable().futureCall(request); + // Do something. + for (Entitlement element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listentitlements_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlementsPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlementsPaged.java new file mode 100644 index 00000000..efc1a84d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/AsyncListEntitlementsPaged.java @@ -0,0 +1,59 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listentitlements_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.ListEntitlementsRequest; +import com.google.cloud.channel.v1.ListEntitlementsResponse; +import com.google.common.base.Strings; + +public class AsyncListEntitlementsPaged { + + public static void main(String[] args) throws Exception { + asyncListEntitlementsPaged(); + } + + public static void asyncListEntitlementsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListEntitlementsRequest request = + ListEntitlementsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListEntitlementsResponse response = + cloudChannelServiceClient.listEntitlementsCallable().call(request); + for (Entitlement element : response.getEntitlementsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listentitlements_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/SyncListEntitlements.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/SyncListEntitlements.java new file mode 100644 index 00000000..3b87cd15 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listentitlements/SyncListEntitlements.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listentitlements_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.ListEntitlementsRequest; + +public class SyncListEntitlements { + + public static void main(String[] args) throws Exception { + syncListEntitlements(); + } + + public static void syncListEntitlements() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListEntitlementsRequest request = + ListEntitlementsRequest.newBuilder() + .setParent(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Entitlement element : cloudChannelServiceClient.listEntitlements(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listentitlements_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffers.java new file mode 100644 index 00000000..11ce1b3e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listoffers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListOffersRequest; +import com.google.cloud.channel.v1.Offer; + +public class AsyncListOffers { + + public static void main(String[] args) throws Exception { + asyncListOffers(); + } + + public static void asyncListOffers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListOffersRequest request = + ListOffersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = + cloudChannelServiceClient.listOffersPagedCallable().futureCall(request); + // Do something. + for (Offer element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listoffers_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffersPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffersPaged.java new file mode 100644 index 00000000..35a40dd1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/AsyncListOffersPaged.java @@ -0,0 +1,59 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listoffers_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListOffersRequest; +import com.google.cloud.channel.v1.ListOffersResponse; +import com.google.cloud.channel.v1.Offer; +import com.google.common.base.Strings; + +public class AsyncListOffersPaged { + + public static void main(String[] args) throws Exception { + asyncListOffersPaged(); + } + + public static void asyncListOffersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListOffersRequest request = + ListOffersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListOffersResponse response = cloudChannelServiceClient.listOffersCallable().call(request); + for (Offer element : response.getOffersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listoffers_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/SyncListOffers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/SyncListOffers.java new file mode 100644 index 00000000..89a731eb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listoffers/SyncListOffers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listoffers_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListOffersRequest; +import com.google.cloud.channel.v1.Offer; + +public class SyncListOffers { + + public static void main(String[] args) throws Exception { + syncListOffers(); + } + + public static void syncListOffers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListOffersRequest request = + ListOffersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setLanguageCode("languageCode-2092349083") + .build(); + for (Offer element : cloudChannelServiceClient.listOffers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listoffers_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProducts.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProducts.java new file mode 100644 index 00000000..4d3374b5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProducts.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listproducts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListProductsRequest; +import com.google.cloud.channel.v1.Product; + +public class AsyncListProducts { + + public static void main(String[] args) throws Exception { + asyncListProducts(); + } + + public static void asyncListProducts() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListProductsRequest request = + ListProductsRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = + cloudChannelServiceClient.listProductsPagedCallable().futureCall(request); + // Do something. + for (Product element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listproducts_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProductsPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProductsPaged.java new file mode 100644 index 00000000..9611632a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/AsyncListProductsPaged.java @@ -0,0 +1,59 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listproducts_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListProductsRequest; +import com.google.cloud.channel.v1.ListProductsResponse; +import com.google.cloud.channel.v1.Product; +import com.google.common.base.Strings; + +public class AsyncListProductsPaged { + + public static void main(String[] args) throws Exception { + asyncListProductsPaged(); + } + + public static void asyncListProductsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListProductsRequest request = + ListProductsRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListProductsResponse response = + cloudChannelServiceClient.listProductsCallable().call(request); + for (Product element : response.getProductsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listproducts_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/SyncListProducts.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/SyncListProducts.java new file mode 100644 index 00000000..db37f7ed --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listproducts/SyncListProducts.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listproducts_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListProductsRequest; +import com.google.cloud.channel.v1.Product; + +public class SyncListProducts { + + public static void main(String[] args) throws Exception { + syncListProducts(); + } + + public static void syncListProducts() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListProductsRequest request = + ListProductsRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + for (Product element : cloudChannelServiceClient.listProducts(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listproducts_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffers.java new file mode 100644 index 00000000..a2a8fd27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listpurchasableoffers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ListPurchasableOffersRequest; +import com.google.cloud.channel.v1.PurchasableOffer; + +public class AsyncListPurchasableOffers { + + public static void main(String[] args) throws Exception { + asyncListPurchasableOffers(); + } + + public static void asyncListPurchasableOffers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListPurchasableOffersRequest request = + ListPurchasableOffersRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = + cloudChannelServiceClient.listPurchasableOffersPagedCallable().futureCall(request); + // Do something. + for (PurchasableOffer element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listpurchasableoffers_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffersPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffersPaged.java new file mode 100644 index 00000000..60b217fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/AsyncListPurchasableOffersPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listpurchasableoffers_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ListPurchasableOffersRequest; +import com.google.cloud.channel.v1.ListPurchasableOffersResponse; +import com.google.cloud.channel.v1.PurchasableOffer; +import com.google.common.base.Strings; + +public class AsyncListPurchasableOffersPaged { + + public static void main(String[] args) throws Exception { + asyncListPurchasableOffersPaged(); + } + + public static void asyncListPurchasableOffersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListPurchasableOffersRequest request = + ListPurchasableOffersRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListPurchasableOffersResponse response = + cloudChannelServiceClient.listPurchasableOffersCallable().call(request); + for (PurchasableOffer element : response.getPurchasableOffersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listpurchasableoffers_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/SyncListPurchasableOffers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/SyncListPurchasableOffers.java new file mode 100644 index 00000000..dada7f3c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableoffers/SyncListPurchasableOffers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listpurchasableoffers_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ListPurchasableOffersRequest; +import com.google.cloud.channel.v1.PurchasableOffer; + +public class SyncListPurchasableOffers { + + public static void main(String[] args) throws Exception { + syncListPurchasableOffers(); + } + + public static void syncListPurchasableOffers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListPurchasableOffersRequest request = + ListPurchasableOffersRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + for (PurchasableOffer element : + cloudChannelServiceClient.listPurchasableOffers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listpurchasableoffers_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkus.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkus.java new file mode 100644 index 00000000..0c082552 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkus.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listpurchasableskus_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ListPurchasableSkusRequest; +import com.google.cloud.channel.v1.PurchasableSku; + +public class AsyncListPurchasableSkus { + + public static void main(String[] args) throws Exception { + asyncListPurchasableSkus(); + } + + public static void asyncListPurchasableSkus() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListPurchasableSkusRequest request = + ListPurchasableSkusRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = + cloudChannelServiceClient.listPurchasableSkusPagedCallable().futureCall(request); + // Do something. + for (PurchasableSku element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listpurchasableskus_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkusPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkusPaged.java new file mode 100644 index 00000000..63a1ee93 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/AsyncListPurchasableSkusPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listpurchasableskus_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ListPurchasableSkusRequest; +import com.google.cloud.channel.v1.ListPurchasableSkusResponse; +import com.google.cloud.channel.v1.PurchasableSku; +import com.google.common.base.Strings; + +public class AsyncListPurchasableSkusPaged { + + public static void main(String[] args) throws Exception { + asyncListPurchasableSkusPaged(); + } + + public static void asyncListPurchasableSkusPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListPurchasableSkusRequest request = + ListPurchasableSkusRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListPurchasableSkusResponse response = + cloudChannelServiceClient.listPurchasableSkusCallable().call(request); + for (PurchasableSku element : response.getPurchasableSkusList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listpurchasableskus_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/SyncListPurchasableSkus.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/SyncListPurchasableSkus.java new file mode 100644 index 00000000..2d4f325e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listpurchasableskus/SyncListPurchasableSkus.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listpurchasableskus_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ListPurchasableSkusRequest; +import com.google.cloud.channel.v1.PurchasableSku; + +public class SyncListPurchasableSkus { + + public static void main(String[] args) throws Exception { + syncListPurchasableSkus(); + } + + public static void syncListPurchasableSkus() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListPurchasableSkusRequest request = + ListPurchasableSkusRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + for (PurchasableSku element : + cloudChannelServiceClient.listPurchasableSkus(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listpurchasableskus_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkus.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkus.java new file mode 100644 index 00000000..64c6e9dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkus.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listskus_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListSkusRequest; +import com.google.cloud.channel.v1.ProductName; +import com.google.cloud.channel.v1.Sku; + +public class AsyncListSkus { + + public static void main(String[] args) throws Exception { + asyncListSkus(); + } + + public static void asyncListSkus() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListSkusRequest request = + ListSkusRequest.newBuilder() + .setParent(ProductName.of("[PRODUCT]").toString()) + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = cloudChannelServiceClient.listSkusPagedCallable().futureCall(request); + // Do something. + for (Sku element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listskus_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkusPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkusPaged.java new file mode 100644 index 00000000..075496cc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/AsyncListSkusPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listskus_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListSkusRequest; +import com.google.cloud.channel.v1.ListSkusResponse; +import com.google.cloud.channel.v1.ProductName; +import com.google.cloud.channel.v1.Sku; +import com.google.common.base.Strings; + +public class AsyncListSkusPaged { + + public static void main(String[] args) throws Exception { + asyncListSkusPaged(); + } + + public static void asyncListSkusPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListSkusRequest request = + ListSkusRequest.newBuilder() + .setParent(ProductName.of("[PRODUCT]").toString()) + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListSkusResponse response = cloudChannelServiceClient.listSkusCallable().call(request); + for (Sku element : response.getSkusList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listskus_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/SyncListSkus.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/SyncListSkus.java new file mode 100644 index 00000000..633c9b8b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listskus/SyncListSkus.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listskus_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListSkusRequest; +import com.google.cloud.channel.v1.ProductName; +import com.google.cloud.channel.v1.Sku; + +public class SyncListSkus { + + public static void main(String[] args) throws Exception { + syncListSkus(); + } + + public static void syncListSkus() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListSkusRequest request = + ListSkusRequest.newBuilder() + .setParent(ProductName.of("[PRODUCT]").toString()) + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setLanguageCode("languageCode-2092349083") + .build(); + for (Sku element : cloudChannelServiceClient.listSkus(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listskus_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribers.java new file mode 100644 index 00000000..93fac85a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listsubscribers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListSubscribersRequest; + +public class AsyncListSubscribers { + + public static void main(String[] args) throws Exception { + asyncListSubscribers(); + } + + public static void asyncListSubscribers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListSubscribersRequest request = + ListSubscribersRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + cloudChannelServiceClient.listSubscribersPagedCallable().futureCall(request); + // Do something. + for (String element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listsubscribers_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribersPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribersPaged.java new file mode 100644 index 00000000..a30b4b10 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/AsyncListSubscribersPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listsubscribers_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListSubscribersRequest; +import com.google.cloud.channel.v1.ListSubscribersResponse; +import com.google.common.base.Strings; + +public class AsyncListSubscribersPaged { + + public static void main(String[] args) throws Exception { + asyncListSubscribersPaged(); + } + + public static void asyncListSubscribersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListSubscribersRequest request = + ListSubscribersRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListSubscribersResponse response = + cloudChannelServiceClient.listSubscribersCallable().call(request); + for (String element : response.getServiceAccountsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listsubscribers_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/SyncListSubscribers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/SyncListSubscribers.java new file mode 100644 index 00000000..d0af0cd6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listsubscribers/SyncListSubscribers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listsubscribers_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListSubscribersRequest; + +public class SyncListSubscribers { + + public static void main(String[] args) throws Exception { + syncListSubscribers(); + } + + public static void syncListSubscribers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListSubscribersRequest request = + ListSubscribersRequest.newBuilder() + .setAccount("account-1177318867") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (String element : cloudChannelServiceClient.listSubscribers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listsubscribers_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffers.java new file mode 100644 index 00000000..c4b40b0f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listtransferableoffers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListTransferableOffersRequest; +import com.google.cloud.channel.v1.TransferableOffer; + +public class AsyncListTransferableOffers { + + public static void main(String[] args) throws Exception { + asyncListTransferableOffers(); + } + + public static void asyncListTransferableOffers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListTransferableOffersRequest request = + ListTransferableOffersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setSku("sku113949") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = + cloudChannelServiceClient.listTransferableOffersPagedCallable().futureCall(request); + // Do something. + for (TransferableOffer element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listtransferableoffers_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffersPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffersPaged.java new file mode 100644 index 00000000..f9f600fc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/AsyncListTransferableOffersPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listtransferableoffers_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListTransferableOffersRequest; +import com.google.cloud.channel.v1.ListTransferableOffersResponse; +import com.google.cloud.channel.v1.TransferableOffer; +import com.google.common.base.Strings; + +public class AsyncListTransferableOffersPaged { + + public static void main(String[] args) throws Exception { + asyncListTransferableOffersPaged(); + } + + public static void asyncListTransferableOffersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListTransferableOffersRequest request = + ListTransferableOffersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setSku("sku113949") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListTransferableOffersResponse response = + cloudChannelServiceClient.listTransferableOffersCallable().call(request); + for (TransferableOffer element : response.getTransferableOffersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listtransferableoffers_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/SyncListTransferableOffers.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/SyncListTransferableOffers.java new file mode 100644 index 00000000..773805a8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableoffers/SyncListTransferableOffers.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listtransferableoffers_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListTransferableOffersRequest; +import com.google.cloud.channel.v1.TransferableOffer; + +public class SyncListTransferableOffers { + + public static void main(String[] args) throws Exception { + syncListTransferableOffers(); + } + + public static void syncListTransferableOffers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListTransferableOffersRequest request = + ListTransferableOffersRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setSku("sku113949") + .setLanguageCode("languageCode-2092349083") + .build(); + for (TransferableOffer element : + cloudChannelServiceClient.listTransferableOffers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listtransferableoffers_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkus.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkus.java new file mode 100644 index 00000000..92fcd2e1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkus.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listtransferableskus_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListTransferableSkusRequest; +import com.google.cloud.channel.v1.TransferableSku; + +public class AsyncListTransferableSkus { + + public static void main(String[] args) throws Exception { + asyncListTransferableSkus(); + } + + public static void asyncListTransferableSkus() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListTransferableSkusRequest request = + ListTransferableSkusRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setAuthToken("authToken1450587441") + .setLanguageCode("languageCode-2092349083") + .build(); + ApiFuture future = + cloudChannelServiceClient.listTransferableSkusPagedCallable().futureCall(request); + // Do something. + for (TransferableSku element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listtransferableskus_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkusPaged.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkusPaged.java new file mode 100644 index 00000000..64cc11e8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/AsyncListTransferableSkusPaged.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listtransferableskus_paged_async] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListTransferableSkusRequest; +import com.google.cloud.channel.v1.ListTransferableSkusResponse; +import com.google.cloud.channel.v1.TransferableSku; +import com.google.common.base.Strings; + +public class AsyncListTransferableSkusPaged { + + public static void main(String[] args) throws Exception { + asyncListTransferableSkusPaged(); + } + + public static void asyncListTransferableSkusPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListTransferableSkusRequest request = + ListTransferableSkusRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setAuthToken("authToken1450587441") + .setLanguageCode("languageCode-2092349083") + .build(); + while (true) { + ListTransferableSkusResponse response = + cloudChannelServiceClient.listTransferableSkusCallable().call(request); + for (TransferableSku element : response.getTransferableSkusList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listtransferableskus_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/SyncListTransferableSkus.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/SyncListTransferableSkus.java new file mode 100644 index 00000000..6f671d83 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/listtransferableskus/SyncListTransferableSkus.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_listtransferableskus_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.ListTransferableSkusRequest; +import com.google.cloud.channel.v1.TransferableSku; + +public class SyncListTransferableSkus { + + public static void main(String[] args) throws Exception { + syncListTransferableSkus(); + } + + public static void syncListTransferableSkus() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ListTransferableSkusRequest request = + ListTransferableSkusRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setAuthToken("authToken1450587441") + .setLanguageCode("languageCode-2092349083") + .build(); + for (TransferableSku element : + cloudChannelServiceClient.listTransferableSkus(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_listtransferableskus_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/AsyncLookupOffer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/AsyncLookupOffer.java new file mode 100644 index 00000000..8a63878f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/AsyncLookupOffer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_lookupoffer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.EntitlementName; +import com.google.cloud.channel.v1.LookupOfferRequest; +import com.google.cloud.channel.v1.Offer; + +public class AsyncLookupOffer { + + public static void main(String[] args) throws Exception { + asyncLookupOffer(); + } + + public static void asyncLookupOffer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + LookupOfferRequest request = + LookupOfferRequest.newBuilder() + .setEntitlement( + EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + ApiFuture future = cloudChannelServiceClient.lookupOfferCallable().futureCall(request); + // Do something. + Offer response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_lookupoffer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/SyncLookupOffer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/SyncLookupOffer.java new file mode 100644 index 00000000..eb545fae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/lookupoffer/SyncLookupOffer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_lookupoffer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.EntitlementName; +import com.google.cloud.channel.v1.LookupOfferRequest; +import com.google.cloud.channel.v1.Offer; + +public class SyncLookupOffer { + + public static void main(String[] args) throws Exception { + syncLookupOffer(); + } + + public static void syncLookupOffer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + LookupOfferRequest request = + LookupOfferRequest.newBuilder() + .setEntitlement( + EntitlementName.of("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]").toString()) + .build(); + Offer response = cloudChannelServiceClient.lookupOffer(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_lookupoffer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentity.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentity.java new file mode 100644 index 00000000..387650aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentity.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_provisioncloudidentity_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.AdminUser; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudIdentityInfo; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ProvisionCloudIdentityRequest; +import com.google.longrunning.Operation; + +public class AsyncProvisionCloudIdentity { + + public static void main(String[] args) throws Exception { + asyncProvisionCloudIdentity(); + } + + public static void asyncProvisionCloudIdentity() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ProvisionCloudIdentityRequest request = + ProvisionCloudIdentityRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setUser(AdminUser.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = + cloudChannelServiceClient.provisionCloudIdentityCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_provisioncloudidentity_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentityLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentityLRO.java new file mode 100644 index 00000000..4f23148e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/AsyncProvisionCloudIdentityLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_provisioncloudidentity_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.AdminUser; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudIdentityInfo; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.ProvisionCloudIdentityRequest; + +public class AsyncProvisionCloudIdentityLRO { + + public static void main(String[] args) throws Exception { + asyncProvisionCloudIdentityLRO(); + } + + public static void asyncProvisionCloudIdentityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ProvisionCloudIdentityRequest request = + ProvisionCloudIdentityRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setUser(AdminUser.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + cloudChannelServiceClient.provisionCloudIdentityOperationCallable().futureCall(request); + // Do something. + Customer response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_provisioncloudidentity_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/SyncProvisionCloudIdentity.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/SyncProvisionCloudIdentity.java new file mode 100644 index 00000000..1073e85d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/provisioncloudidentity/SyncProvisionCloudIdentity.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_provisioncloudidentity_sync] +import com.google.cloud.channel.v1.AdminUser; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CloudIdentityInfo; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.CustomerName; +import com.google.cloud.channel.v1.ProvisionCloudIdentityRequest; + +public class SyncProvisionCloudIdentity { + + public static void main(String[] args) throws Exception { + syncProvisionCloudIdentity(); + } + + public static void syncProvisionCloudIdentity() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ProvisionCloudIdentityRequest request = + ProvisionCloudIdentityRequest.newBuilder() + .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString()) + .setCloudIdentityInfo(CloudIdentityInfo.newBuilder().build()) + .setUser(AdminUser.newBuilder().build()) + .setValidateOnly(true) + .build(); + Customer response = cloudChannelServiceClient.provisionCloudIdentityAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_provisioncloudidentity_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/AsyncRegisterSubscriber.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/AsyncRegisterSubscriber.java new file mode 100644 index 00000000..1cbe4835 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/AsyncRegisterSubscriber.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_registersubscriber_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.RegisterSubscriberRequest; +import com.google.cloud.channel.v1.RegisterSubscriberResponse; + +public class AsyncRegisterSubscriber { + + public static void main(String[] args) throws Exception { + asyncRegisterSubscriber(); + } + + public static void asyncRegisterSubscriber() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + RegisterSubscriberRequest request = + RegisterSubscriberRequest.newBuilder() + .setAccount("account-1177318867") + .setServiceAccount("serviceAccount1079137720") + .build(); + ApiFuture future = + cloudChannelServiceClient.registerSubscriberCallable().futureCall(request); + // Do something. + RegisterSubscriberResponse response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_registersubscriber_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/SyncRegisterSubscriber.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/SyncRegisterSubscriber.java new file mode 100644 index 00000000..8eb8f4ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/registersubscriber/SyncRegisterSubscriber.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_registersubscriber_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.RegisterSubscriberRequest; +import com.google.cloud.channel.v1.RegisterSubscriberResponse; + +public class SyncRegisterSubscriber { + + public static void main(String[] args) throws Exception { + syncRegisterSubscriber(); + } + + public static void syncRegisterSubscriber() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + RegisterSubscriberRequest request = + RegisterSubscriberRequest.newBuilder() + .setAccount("account-1177318867") + .setServiceAccount("serviceAccount1079137720") + .build(); + RegisterSubscriberResponse response = cloudChannelServiceClient.registerSubscriber(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_registersubscriber_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidService.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidService.java new file mode 100644 index 00000000..5424bc2d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidService.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_startpaidservice_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.StartPaidServiceRequest; +import com.google.longrunning.Operation; + +public class AsyncStartPaidService { + + public static void main(String[] args) throws Exception { + asyncStartPaidService(); + } + + public static void asyncStartPaidService() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + StartPaidServiceRequest request = + StartPaidServiceRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.startPaidServiceCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_startpaidservice_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidServiceLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidServiceLRO.java new file mode 100644 index 00000000..9bbc15a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/AsyncStartPaidServiceLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_startpaidservice_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.StartPaidServiceRequest; + +public class AsyncStartPaidServiceLRO { + + public static void main(String[] args) throws Exception { + asyncStartPaidServiceLRO(); + } + + public static void asyncStartPaidServiceLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + StartPaidServiceRequest request = + StartPaidServiceRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.startPaidServiceOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_startpaidservice_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/SyncStartPaidService.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/SyncStartPaidService.java new file mode 100644 index 00000000..3c629f19 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/startpaidservice/SyncStartPaidService.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_startpaidservice_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.StartPaidServiceRequest; + +public class SyncStartPaidService { + + public static void main(String[] args) throws Exception { + syncStartPaidService(); + } + + public static void syncStartPaidService() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + StartPaidServiceRequest request = + StartPaidServiceRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + Entitlement response = cloudChannelServiceClient.startPaidServiceAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_startpaidservice_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlement.java new file mode 100644 index 00000000..fe2a35fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_suspendentitlement_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.SuspendEntitlementRequest; +import com.google.longrunning.Operation; + +public class AsyncSuspendEntitlement { + + public static void main(String[] args) throws Exception { + asyncSuspendEntitlement(); + } + + public static void asyncSuspendEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + SuspendEntitlementRequest request = + SuspendEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.suspendEntitlementCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_suspendentitlement_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlementLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlementLRO.java new file mode 100644 index 00000000..5ed86bdc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/AsyncSuspendEntitlementLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_suspendentitlement_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.SuspendEntitlementRequest; + +public class AsyncSuspendEntitlementLRO { + + public static void main(String[] args) throws Exception { + asyncSuspendEntitlementLRO(); + } + + public static void asyncSuspendEntitlementLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + SuspendEntitlementRequest request = + SuspendEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.suspendEntitlementOperationCallable().futureCall(request); + // Do something. + Entitlement response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_suspendentitlement_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/SyncSuspendEntitlement.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/SyncSuspendEntitlement.java new file mode 100644 index 00000000..a9fd1153 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/suspendentitlement/SyncSuspendEntitlement.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_suspendentitlement_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.SuspendEntitlementRequest; + +public class SyncSuspendEntitlement { + + public static void main(String[] args) throws Exception { + syncSuspendEntitlement(); + } + + public static void syncSuspendEntitlement() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + SuspendEntitlementRequest request = + SuspendEntitlementRequest.newBuilder() + .setName("name3373707") + .setRequestId("requestId693933066") + .build(); + Entitlement response = cloudChannelServiceClient.suspendEntitlementAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_suspendentitlement_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlements.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlements.java new file mode 100644 index 00000000..45656000 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlements.java @@ -0,0 +1,51 @@ +/* + * 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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_transferentitlements_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.TransferEntitlementsRequest; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncTransferEntitlements { + + public static void main(String[] args) throws Exception { + asyncTransferEntitlements(); + } + + public static void asyncTransferEntitlements() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + TransferEntitlementsRequest request = + TransferEntitlementsRequest.newBuilder() + .setParent("parent-995424086") + .addAllEntitlements(new ArrayList()) + .setAuthToken("authToken1450587441") + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.transferEntitlementsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_transferentitlements_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlementsLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlementsLRO.java new file mode 100644 index 00000000..9509f38a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/AsyncTransferEntitlementsLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_transferentitlements_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.TransferEntitlementsRequest; +import com.google.cloud.channel.v1.TransferEntitlementsResponse; +import java.util.ArrayList; + +public class AsyncTransferEntitlementsLRO { + + public static void main(String[] args) throws Exception { + asyncTransferEntitlementsLRO(); + } + + public static void asyncTransferEntitlementsLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + TransferEntitlementsRequest request = + TransferEntitlementsRequest.newBuilder() + .setParent("parent-995424086") + .addAllEntitlements(new ArrayList()) + .setAuthToken("authToken1450587441") + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient.transferEntitlementsOperationCallable().futureCall(request); + // Do something. + TransferEntitlementsResponse response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_transferentitlements_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/SyncTransferEntitlements.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/SyncTransferEntitlements.java new file mode 100644 index 00000000..f846e0ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlements/SyncTransferEntitlements.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_transferentitlements_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.TransferEntitlementsRequest; +import com.google.cloud.channel.v1.TransferEntitlementsResponse; +import java.util.ArrayList; + +public class SyncTransferEntitlements { + + public static void main(String[] args) throws Exception { + syncTransferEntitlements(); + } + + public static void syncTransferEntitlements() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + TransferEntitlementsRequest request = + TransferEntitlementsRequest.newBuilder() + .setParent("parent-995424086") + .addAllEntitlements(new ArrayList()) + .setAuthToken("authToken1450587441") + .setRequestId("requestId693933066") + .build(); + TransferEntitlementsResponse response = + cloudChannelServiceClient.transferEntitlementsAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_transferentitlements_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogle.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogle.java new file mode 100644 index 00000000..d19a23d0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogle.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_transferentitlementstogoogle_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.TransferEntitlementsToGoogleRequest; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncTransferEntitlementsToGoogle { + + public static void main(String[] args) throws Exception { + asyncTransferEntitlementsToGoogle(); + } + + public static void asyncTransferEntitlementsToGoogle() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + TransferEntitlementsToGoogleRequest request = + TransferEntitlementsToGoogleRequest.newBuilder() + .setParent("parent-995424086") + .addAllEntitlements(new ArrayList()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + cloudChannelServiceClient.transferEntitlementsToGoogleCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_transferentitlementstogoogle_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogleLRO.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogleLRO.java new file mode 100644 index 00000000..25a1b450 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/AsyncTransferEntitlementsToGoogleLRO.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_transferentitlementstogoogle_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.OperationMetadata; +import com.google.cloud.channel.v1.TransferEntitlementsToGoogleRequest; +import com.google.protobuf.Empty; +import java.util.ArrayList; + +public class AsyncTransferEntitlementsToGoogleLRO { + + public static void main(String[] args) throws Exception { + asyncTransferEntitlementsToGoogleLRO(); + } + + public static void asyncTransferEntitlementsToGoogleLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + TransferEntitlementsToGoogleRequest request = + TransferEntitlementsToGoogleRequest.newBuilder() + .setParent("parent-995424086") + .addAllEntitlements(new ArrayList()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + cloudChannelServiceClient + .transferEntitlementsToGoogleOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_transferentitlementstogoogle_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/SyncTransferEntitlementsToGoogle.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/SyncTransferEntitlementsToGoogle.java new file mode 100644 index 00000000..8b094874 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/transferentitlementstogoogle/SyncTransferEntitlementsToGoogle.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_transferentitlementstogoogle_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Entitlement; +import com.google.cloud.channel.v1.TransferEntitlementsToGoogleRequest; +import java.util.ArrayList; + +public class SyncTransferEntitlementsToGoogle { + + public static void main(String[] args) throws Exception { + syncTransferEntitlementsToGoogle(); + } + + public static void syncTransferEntitlementsToGoogle() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + TransferEntitlementsToGoogleRequest request = + TransferEntitlementsToGoogleRequest.newBuilder() + .setParent("parent-995424086") + .addAllEntitlements(new ArrayList()) + .setRequestId("requestId693933066") + .build(); + cloudChannelServiceClient.transferEntitlementsToGoogleAsync(request).get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_transferentitlementstogoogle_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/AsyncUnregisterSubscriber.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/AsyncUnregisterSubscriber.java new file mode 100644 index 00000000..4feebd92 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/AsyncUnregisterSubscriber.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_unregistersubscriber_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.UnregisterSubscriberRequest; +import com.google.cloud.channel.v1.UnregisterSubscriberResponse; + +public class AsyncUnregisterSubscriber { + + public static void main(String[] args) throws Exception { + asyncUnregisterSubscriber(); + } + + public static void asyncUnregisterSubscriber() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UnregisterSubscriberRequest request = + UnregisterSubscriberRequest.newBuilder() + .setAccount("account-1177318867") + .setServiceAccount("serviceAccount1079137720") + .build(); + ApiFuture future = + cloudChannelServiceClient.unregisterSubscriberCallable().futureCall(request); + // Do something. + UnregisterSubscriberResponse response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_unregistersubscriber_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/SyncUnregisterSubscriber.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/SyncUnregisterSubscriber.java new file mode 100644 index 00000000..e2161669 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/unregistersubscriber/SyncUnregisterSubscriber.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_unregistersubscriber_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.UnregisterSubscriberRequest; +import com.google.cloud.channel.v1.UnregisterSubscriberResponse; + +public class SyncUnregisterSubscriber { + + public static void main(String[] args) throws Exception { + syncUnregisterSubscriber(); + } + + public static void syncUnregisterSubscriber() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UnregisterSubscriberRequest request = + UnregisterSubscriberRequest.newBuilder() + .setAccount("account-1177318867") + .setServiceAccount("serviceAccount1079137720") + .build(); + UnregisterSubscriberResponse response = + cloudChannelServiceClient.unregisterSubscriber(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_unregistersubscriber_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/AsyncUpdateChannelPartnerLink.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/AsyncUpdateChannelPartnerLink.java new file mode 100644 index 00000000..bc126e7d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/AsyncUpdateChannelPartnerLink.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerlink_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.UpdateChannelPartnerLinkRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateChannelPartnerLink { + + public static void main(String[] args) throws Exception { + asyncUpdateChannelPartnerLink(); + } + + public static void asyncUpdateChannelPartnerLink() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateChannelPartnerLinkRequest request = + UpdateChannelPartnerLinkRequest.newBuilder() + .setName("name3373707") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient.updateChannelPartnerLinkCallable().futureCall(request); + // Do something. + ChannelPartnerLink response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerlink_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/SyncUpdateChannelPartnerLink.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/SyncUpdateChannelPartnerLink.java new file mode 100644 index 00000000..fa975027 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerlink/SyncUpdateChannelPartnerLink.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerlink_sync] +import com.google.cloud.channel.v1.ChannelPartnerLink; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.UpdateChannelPartnerLinkRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateChannelPartnerLink { + + public static void main(String[] args) throws Exception { + syncUpdateChannelPartnerLink(); + } + + public static void syncUpdateChannelPartnerLink() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateChannelPartnerLinkRequest request = + UpdateChannelPartnerLinkRequest.newBuilder() + .setName("name3373707") + .setChannelPartnerLink(ChannelPartnerLink.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ChannelPartnerLink response = cloudChannelServiceClient.updateChannelPartnerLink(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerlink_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/AsyncUpdateChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/AsyncUpdateChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..caf4e2c8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/AsyncUpdateChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.UpdateChannelPartnerRepricingConfigRequest; + +public class AsyncUpdateChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateChannelPartnerRepricingConfig(); + } + + public static void asyncUpdateChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateChannelPartnerRepricingConfigRequest request = + UpdateChannelPartnerRepricingConfigRequest.newBuilder() + .setChannelPartnerRepricingConfig(ChannelPartnerRepricingConfig.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient + .updateChannelPartnerRepricingConfigCallable() + .futureCall(request); + // Do something. + ChannelPartnerRepricingConfig response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfig.java new file mode 100644 index 00000000..8c668318 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.UpdateChannelPartnerRepricingConfigRequest; + +public class SyncUpdateChannelPartnerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncUpdateChannelPartnerRepricingConfig(); + } + + public static void syncUpdateChannelPartnerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateChannelPartnerRepricingConfigRequest request = + UpdateChannelPartnerRepricingConfigRequest.newBuilder() + .setChannelPartnerRepricingConfig(ChannelPartnerRepricingConfig.newBuilder().build()) + .build(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.updateChannelPartnerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig.java new file mode 100644 index 00000000..ae4e22ca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatechannelpartnerrepricingconfig/SyncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerrepricingconfig_channelpartnerrepricingconfig_sync] +import com.google.cloud.channel.v1.ChannelPartnerRepricingConfig; +import com.google.cloud.channel.v1.CloudChannelServiceClient; + +public class SyncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig { + + public static void main(String[] args) throws Exception { + syncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig(); + } + + public static void syncUpdateChannelPartnerRepricingConfigChannelpartnerrepricingconfig() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + ChannelPartnerRepricingConfig channelPartnerRepricingConfig = + ChannelPartnerRepricingConfig.newBuilder().build(); + ChannelPartnerRepricingConfig response = + cloudChannelServiceClient.updateChannelPartnerRepricingConfig( + channelPartnerRepricingConfig); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_updatechannelpartnerrepricingconfig_channelpartnerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/AsyncUpdateCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/AsyncUpdateCustomer.java new file mode 100644 index 00000000..70490463 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/AsyncUpdateCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatecustomer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.UpdateCustomerRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCustomer { + + public static void main(String[] args) throws Exception { + asyncUpdateCustomer(); + } + + public static void asyncUpdateCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateCustomerRequest request = + UpdateCustomerRequest.newBuilder() + .setCustomer(Customer.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient.updateCustomerCallable().futureCall(request); + // Do something. + Customer response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatecustomer_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/SyncUpdateCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/SyncUpdateCustomer.java new file mode 100644 index 00000000..16822c20 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomer/SyncUpdateCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatecustomer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.Customer; +import com.google.cloud.channel.v1.UpdateCustomerRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCustomer { + + public static void main(String[] args) throws Exception { + syncUpdateCustomer(); + } + + public static void syncUpdateCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateCustomerRequest request = + UpdateCustomerRequest.newBuilder() + .setCustomer(Customer.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Customer response = cloudChannelServiceClient.updateCustomer(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatecustomer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/AsyncUpdateCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/AsyncUpdateCustomerRepricingConfig.java new file mode 100644 index 00000000..d7b48d16 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/AsyncUpdateCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatecustomerrepricingconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.UpdateCustomerRepricingConfigRequest; + +public class AsyncUpdateCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateCustomerRepricingConfig(); + } + + public static void asyncUpdateCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateCustomerRepricingConfigRequest request = + UpdateCustomerRepricingConfigRequest.newBuilder() + .setCustomerRepricingConfig(CustomerRepricingConfig.newBuilder().build()) + .build(); + ApiFuture future = + cloudChannelServiceClient.updateCustomerRepricingConfigCallable().futureCall(request); + // Do something. + CustomerRepricingConfig response = future.get(); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatecustomerrepricingconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfig.java new file mode 100644 index 00000000..f01f975c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfig.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelserviceclient_updatecustomerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; +import com.google.cloud.channel.v1.UpdateCustomerRepricingConfigRequest; + +public class SyncUpdateCustomerRepricingConfig { + + public static void main(String[] args) throws Exception { + syncUpdateCustomerRepricingConfig(); + } + + public static void syncUpdateCustomerRepricingConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + UpdateCustomerRepricingConfigRequest request = + UpdateCustomerRepricingConfigRequest.newBuilder() + .setCustomerRepricingConfig(CustomerRepricingConfig.newBuilder().build()) + .build(); + CustomerRepricingConfig response = + cloudChannelServiceClient.updateCustomerRepricingConfig(request); + } + } +} +// [END channel_v1_generated_cloudchannelserviceclient_updatecustomerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfigCustomerrepricingconfig.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfigCustomerrepricingconfig.java new file mode 100644 index 00000000..11708418 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelserviceclient/updatecustomerrepricingconfig/SyncUpdateCustomerRepricingConfigCustomerrepricingconfig.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.channel.v1.samples; + +// [START +// channel_v1_generated_cloudchannelserviceclient_updatecustomerrepricingconfig_customerrepricingconfig_sync] +import com.google.cloud.channel.v1.CloudChannelServiceClient; +import com.google.cloud.channel.v1.CustomerRepricingConfig; + +public class SyncUpdateCustomerRepricingConfigCustomerrepricingconfig { + + public static void main(String[] args) throws Exception { + syncUpdateCustomerRepricingConfigCustomerrepricingconfig(); + } + + public static void syncUpdateCustomerRepricingConfigCustomerrepricingconfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) { + CustomerRepricingConfig customerRepricingConfig = + CustomerRepricingConfig.newBuilder().build(); + CustomerRepricingConfig response = + cloudChannelServiceClient.updateCustomerRepricingConfig(customerRepricingConfig); + } + } +} +// [END +// channel_v1_generated_cloudchannelserviceclient_updatecustomerrepricingconfig_customerrepricingconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelservicesettings/getcustomer/SyncGetCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelservicesettings/getcustomer/SyncGetCustomer.java new file mode 100644 index 00000000..095055ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/cloudchannelservicesettings/getcustomer/SyncGetCustomer.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.channel.v1.samples; + +// [START channel_v1_generated_cloudchannelservicesettings_getcustomer_sync] +import com.google.cloud.channel.v1.CloudChannelServiceSettings; +import java.time.Duration; + +public class SyncGetCustomer { + + public static void main(String[] args) throws Exception { + syncGetCustomer(); + } + + public static void syncGetCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudChannelServiceSettings.Builder cloudChannelServiceSettingsBuilder = + CloudChannelServiceSettings.newBuilder(); + cloudChannelServiceSettingsBuilder + .getCustomerSettings() + .setRetrySettings( + cloudChannelServiceSettingsBuilder + .getCustomerSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudChannelServiceSettings cloudChannelServiceSettings = + cloudChannelServiceSettingsBuilder.build(); + } +} +// [END channel_v1_generated_cloudchannelservicesettings_getcustomer_sync] diff --git a/samples/snippets/generated/com/google/cloud/channel/v1/stub/cloudchannelservicestubsettings/getcustomer/SyncGetCustomer.java b/samples/snippets/generated/com/google/cloud/channel/v1/stub/cloudchannelservicestubsettings/getcustomer/SyncGetCustomer.java new file mode 100644 index 00000000..0640fd6f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/channel/v1/stub/cloudchannelservicestubsettings/getcustomer/SyncGetCustomer.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.channel.v1.stub.samples; + +// [START channel_v1_generated_cloudchannelservicestubsettings_getcustomer_sync] +import com.google.cloud.channel.v1.stub.CloudChannelServiceStubSettings; +import java.time.Duration; + +public class SyncGetCustomer { + + public static void main(String[] args) throws Exception { + syncGetCustomer(); + } + + public static void syncGetCustomer() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CloudChannelServiceStubSettings.Builder cloudChannelServiceSettingsBuilder = + CloudChannelServiceStubSettings.newBuilder(); + cloudChannelServiceSettingsBuilder + .getCustomerSettings() + .setRetrySettings( + cloudChannelServiceSettingsBuilder + .getCustomerSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CloudChannelServiceStubSettings cloudChannelServiceSettings = + cloudChannelServiceSettingsBuilder.build(); + } +} +// [END channel_v1_generated_cloudchannelservicestubsettings_getcustomer_sync]